Antonio Pampliega, Jose Manuel Lopez and Angel Sastre, who were working as freelancers for several Spanish news outlets, were abducted in Aleppo in July 2015. They were released and transferred to Turkey on Saturday.
"Finally at home we will soon [see] Antonio, Jose Manuel and Angel. I share the joy of their families, colleagues and friends. MR," Rajoy tweeted after special aircraft with the reporters on board had landed at Torrejon air base near Madrid.
Syria has been mired in civil war since March 2011, with government forces loyal to Syrian President Bashar Assad fighting numerous opposition factions and extremist groups, including Nursa Front, outlawed in many countries including Russia.
Aleppo, the largest city in Syria, was attacked by militants in 2012. Since then, Syrian government forces have been fighting for the city.