Prime Minister Mariano Rajoy's office said in a statement that Antonio Pampliega, Jose Manuel Lopez and Angel Sastre, who disappeared near the city of Aleppo in northern Syria on July 12, were safe and well.
Acting Deputy Prime Minister Soraya Saenz de Santamaria had spoken to them by telephone, the statement said.
The government says the intervention of Turkey, Qatar and "other allies and friends" was instrumental in freeing the men, and that a plane was being sent to Turkey to bring them back to Spain.
Elsa Gonzalez, president of Spain's federation of journalists, said the news was a cause for "joy and emotion."
"Work by reporters like these elevates journalism," Gonzalez said.
They had traveled to Syria, presumably together, to report on the civil war.
Gonzalez said last year that the three were experienced journalists who had all worked in Syria before and knew what type of precautions they would need to take.
Previously, three other Spanish journalists were released in March 2014 after being held hostage by Syrian extremists for months. It is widely believed that their government paid a ransom for their release, although it has not been officially confirmed.