The agreement was signed in Havana's Revolution Palace by Cuban Foreign Minister Bruno Rodriguez and his Spanish counterpart Josep Borrell Fontelles in the presence of Cuban President Miguel Diaz-Canel and visiting King Felipe VI of Spain.
The document includes cooperation in three areas: increasing productivity, sustainable territorial development and the consolidation of an effective public administration, according to the Spanish Foreign Ministry.
Before the signing of the agreement, King Felipe VI had been officially welcomed by President Diaz-Canel, with whom he held formal talks.
Earlier, the visiting royal couple paid tribute to Jose Marti, the Cuban National Hero, in the Revolution Square.
The Spanish monarchs arrived in Havana on Monday for a three-day state visit, as part of the celebrations marking the 500 years' anniversary of the foundation of Havana.
This is the first official trip of a Spanish king to Cuba.