Members of the lower house of parliament voted 297-29 in support of the 86-billion-euro (96-billion-dollar) aid package with only the tiny far-left United Left party voting against it.
Spain, which received European financial aid for its ailing banks in 2012, will supply 10.15 billion euros to the latest Greek bailout.
Unlike other eurozone nations such as Germany, Spain was not required to have its parliament approve the bailout but Prime Minister Mariano Rajoy said he decided to put it to a vote because Madrid's contribution to the aid package is “significant”.
The vote was guaranteed to pass because Rajoy's conservative Popular Party (PP) has an absolute majority in the assembly.
The PP used the debate to promote itself as the guarantor of Spain's economic recovery going into elections due at the end of the year where they face a stiff challenge from new anti-austerity party Podemos, a close ally of Greece's radical left ruling Syriza party.
“There are three lessons to learn from the Greek crisis. First of all, we can't get around the obstacle (of reforms). Secondly, populist siren songs only end in mirages,” Economy Minister Luis de Guindos told the assembly.
“Finally… irresponsible policies have a price,” he added.
During an interview with news radio Cadena Ser, the Podemos secretary for political affairs, Inigo Errejon, accused the government of debating the Greek bailout in parliament “for propaganda reasons”.
Rajoy is betting on Spain's economic recovery to win re-election to a second term despite poor personal approval ratings.
Spain emerged in 2013 from five years of on-off recession, and the government forecasts the economy will grow by 3.3 percent this year — more than twice the average forecast for eurozone countries — and by 3.0 percent next year.
But unemployment stood at 22.4 percent in the second quarter, the second-highest rate in the eurozone after that of bailed-out Greece.
Eurozone finance ministers on Friday gave the green light to the latest Greek bailout package, which averted the country's expulsion from the euro but will require more sacrifices from Greeks.
Finland, one of the eurozone countries most sceptical about pouring more aid into Greece, also backed the bailout last Thursday. The German parliament will vote on it on Wednesday.