Until 2010, the official rule was to use accent (tilde diacrítica in Spanish) to differentiate the pronoun from the adjective, as @snumpy has already said.
The (IMHO) sad news is that since 2010 the rules have been changed by RAE, and now it is recommended to avoid the use of the accent in this case, even when there is an obvious case of ambiguity:
Eliminación de la tilde diacrítica en el adverbio solo y los pronombres demostrativos incluso en casos de posible ambigüedad
Sólo / Solo:
Estaré sólo dos meses (I'll stay only two months).
Estaré solo dos meses (I'll be alone during two months).
Éste / Este:
Éste sólo gustó a los más exigentes (This one was only liked by the most demanding).
Este solo gustó a los más exigentes (This solo [Music] was liked by the most. demanding)
- In the first line, may be written with comma to avoid ambiguity: Éste, sólo gustó a los más exigentes.
Aquéllos / Aquellos:
¿Por qué compraron aquéllos libros usados? (Why did they buy used books?)
¿Por qué compraron aquellos libros usados? (Why did they buy those used books?)
- In the first line, the subject may be enclosed with commas due to the "hipérbaton": ¿Por qué compraron, aquéllos, libros usados?