The main idea of Pretérito Perfecto is the connection between the past and the present. The action has already happened, but for the speaker it is not completely “separated” from the current moment. It can be recent news, personal experience, a result that is visible now, or an event within a period that is still continuing.
The first common case is an action that happened within a time period that has not yet ended. For example, if today is still continuing, you can say:
Hoy he trabajado mucho.
Today I have worked a lot.
The period hoy has not ended yet, so a Spaniard will often choose Pretérito Perfecto. The same applies to expressions such as esta semana, este mes, este año, últimamente.
Esta semana hemos tenido tres reuniones.
This week we have had three meetings.
The week is still perceived as current, so the action is connected with the present.
The second case is when the result of the action is important now.
He perdido las llaves.
I have lost the keys.
The meaning is not only that the action happened earlier. What matters is that now there are no keys. It is precisely the current result that makes Pretérito Perfecto very useful.
Se ha roto el ordenador.
The computer has broken.
The speaker reports an event because its consequences are relevant at this moment.
The third case is life experience without an exact indication of time.
He estado en México.
I have been to Mexico.
Here it is not important when exactly this happened. What matters is that such experience exists.
Nunca he probado la paella.
I have never tried paella.
¿Has leído a García Márquez?
Have you read García Márquez?
The fourth case is recent events. In Spain, Pretérito Perfecto is often used when the speaker considers the event close to the present.
He hablado con Ana hace un momento.
I have just spoken with Ana.
Ya hemos enviado el correo.
We have already sent the email.
However, there is a regional difference here. In Spain, Pretérito Perfecto is used very actively. In many Latin American countries, in similar situations, Pretérito Indefinido is used more often: hablé, terminé, vi. This does not mean that one form is always incorrect and the other is correct. Region and context must be taken into account.