Spain's Lower House of Parliament has voted in a secret ballot instigated by the opposition calling on parliamentarians to oppose the government's support of military action in Iraq.
By the BBC's Danny Wood
Correspondent in Madrid
But the motion has been defeated.
Mr Aznar welcomed the result
The secret ballot has been a test of loyalty for members of Prime Minister Jose Maria Aznar's Popular Party.
After over four hours debating and voting the Speaker of the House announced the result.
With 184 votes cast against and 163 in support, it was a resounding victory for the government.
It appears that every member of the governing Popular Party and one member of the opposition voted to defeat the motion.
The Prime Minister was confident that all of his politicians would rally in support.
The extra opposition member comes as a pleasant surprise.
The government has a majority of 16 in the House, but all opposition parties are against the use of force in Iraq.
That meant only nine Popular Party votes were needed to win the vote, which called for more weapons inspectors and opposed military action.
The secret ballot, permitted under Spain's law, was an attempt by the opposition to draw out members of the Popular Party with anti-war sentiments.
It followed an open vote on the government's stance on the Iraq crisis.
That vote held no surprises: All 183 Popular Party members supported the government's policy of force as a last resort; 100 opposition members casting against.
Popular Party members cheered the result of the vote
But there was considerable expectation that the secret vote could embarrass the government.
The debate was heated. After a series of interruptions from the floor, Jesus Caldera, from the opposition Socialists, said: "Everyone knows our position - no to war."
Gustavo de Aristegui, Popular Party spokesperson, argued that his party does want to disarm Saddam Hussein peacefully.
For Prime Minister Aznar the secret ballot has confirmed that his own party is behind him, but the vote has emphasised that his Popular Party is isolated in Spain's parliament.