The unanimous vote came on the same day that two Palestinians armed with a gun and meat cleavers burst into a Jerusalem synagogue and killed five Israelis in the bloodiest attack in the city in years.
The motion, proposed by the Socialists, calls on the Spanish government to "recognize Palestine as a state", according to the text presented by the Socialists.
It also urges Prime Minister Mariano Rajoy "to promote in coordination with the European Union the recognition of the Palestinian state as sovereign, contiguous, democratic and independent which lives in peace and security with the state of Israel."
"It is not binding, it does not set a timeline for the recognition, it gives the government the margin to proceed with the recognition when it feels it will be opportune," Spanish Foreign Minister José Manuel García-Margallo told reporters of the motion in Brussels on Monday.
"If we want to be effective this recognition must be done in coordination with the European Union," he added.
Israel's ambassador to Spain Alon Bar said on Monday he was satisfied "in principle" with the Spanish foreign minister's announcement that any recognition of Palestine would always dependent on peace talks with Israel.
The Spanish parliament's motion follows moves in other European countries intended to increase pressure for a two-state solution to the Israeli-Palestinian conflict.
Britain and Ireland approved similar motions last month. Sweden's new left-leaning government went a step further and officially recognized a Palestinian state on October 30th, prompting a strong protest from Israel, which swiftly withdrew its ambassador from Stockholm.
Sweden has since announced it does not plan to open an embassy on Palestinian soil.
The efforts in Europe reflect growing international impatience with Israel's nearly half-century control of the West Bank, east Jerusalem and its blockade of the Gaza Strip.