Graduarse vs. licenciarse

In Spanish, 'graduarse' and 'licenciarse' are often used interchangeably to mean to graduate or to earn a degree from university. Yet, there exist subtle differences when these terms are used in different contexts.

Graduarse

'Graduarse' can refer to completing any level of academic studies, not only at the university but also in high school, or getting a master's degree etc.
Mi hermana se graduó de la escuela secundaria ayer.
(My sister graduated from high school yesterday.)
Me gradué con un master en economía.
(I graduated with a master's degree in economics.)
Pedro se va a graduar de la universidad en junio.
(Pedro is going to graduate from the university in June.)

Licenciarse

'Licenciarse' refers more specifically to earning a bachelor's (licentiate) degree from university. So this term is not used for graduating from high school or getting higher degrees like master or doctorate.
Maria se licenció de la Universidad de Salamanca.
(Maria earned her bachelor's degree from the University of Salamanca.)
El año próximo me licenciaré en Derecho.
(Next year, I will earn my bachelor's degree in Law.)
Juan se licenció en Ingeniería Civil hace dos años.
(Juan earned his bachelor's degree in Civil Engineering two years ago.)

Summary

While both 'graduarse' and 'licenciarse' refer to completion of academic studies, the usage of 'graduarse' is broader and can be used for all levels of graduation including high school, university degrees etc. On the other hand, 'licenciarse', although can also mean to graduate, it tends specifically to refer to getting a bachelor's degree from university.