Canadian Prime Minister Paul Martin has survived a crucial parliament motion by a single vote, keeping him in power.
Paul Martin urged the opposition to join in a spirit of co-operation
His minority Liberal government was saved when independent MP Chuck Cadman made a last-minute decision to back it.
With the ballot tied at 152 votes each, it fell to Speaker Peter Milliken, a Liberal, to cast the deciding vote in favour of the administration.
The opposition had been determined to defeat the government, which has been dogged by a financial scandal.
The vote ended a month-long drama that started when the opposition Conservatives and the Bloc Quebecois said the financial scandal, dating back to the 1990s, meant the government must go.
Parliament was voting on the federal budget but it was effectively being treated as a confidence vote in the government.
"The margin of tonight's vote is very narrow - indeed that is an understatement," said Mr Martin, moments after the result of the vote was announced.
"We must now move forward in a spirit of co-operation. We ask the opposition to join with us in a renewed effort to make this Parliament work for the people of Canada."
Earlier this week, Mr Martin's survival hopes were given a boost with the last-minute defection of a leading politician from the Conservatives, Belinda Stronach.
But in response to Mr Martin's appeals after the vote, the leader of the Conservatives, Stephen Harper, only promised to continue to provide vigorous opposition.
Mr Martin's government has been under pressure amid allegations of irregularities over public advertising contracts awarded during a previous administration.
The financial scandal dates back to the 1990s.
Canada's auditor-general issued a report last year which said that in the late 1990s, the governing Liberals systematically channelled at least C$100m ($81m; £43m) from a C$250m government programme to advertising and communication agencies with ties to the Liberal Party, for little or no work.
Mr Martin - who was the finance minister at the time - is not implicated in the scandal.
But the Conservatives say the government is corrupt and should be forced out of office.
Mr Martin has said an election should be delayed till an inquiry into the corruption scandal issues a final report in December.
Now that the country has been saved from another election, it's time for politicians to get to work. I think the biggest trouble that people have with politics is that there is no vision of improvement or achievements that we can really follow. Recently we had a vote on who the greatest Canadian was. Politicians and individual people should vote on various goals or projects and get people more involved with government.
Philipp Hromek, Barrie, ON, Canada
Despite my dislike for the current government, I think we should be giving Martin a chance. He was not involved with the sponsorship scandal at the time, he is just the unfortunate person leading our wonderful country. I think we all should stop speculating, spreading rumours and finger pointing until the Gomery report has been released. Then, it's a free for all.
Kate, Moncton, NB, Canada
I don't like politicians wasting energy over such questionably useful debates. In the meantime, nothing is done to improve the economy, employment, etc. On the other hand, I am glad that a general election was avoided by yesterday's vote. I am afraid it would have led to another minority government. Then the question would have been: is this country still governable? I hope we never get to this point because then again, energy would be lost on purely political debates.
David Walsh, Quebec City, Canada
The government of Canada has become nothing more than a playground for wealthy aristocrats and business people to play around with laws, rules and enjoy the drama of high status. I really have no faith in the state of my country anymore.
Jeffrey Kotyk, Winnipeg, Manitoba, Canada
We should wait for the Gomery report first. To have an election sooner would be to decide based on rumours and media speculation.
Robert Prior, Toronto, Canada
This vote of confidence showed that Canadian politicians are still on the level. They can distinguish high political standards from opportunism. Although shaken by the sponsorship scandal, liberals are showing that if they have not done the right thing, at least, the things they're doing, they're doing them right.
Pierrino Torbey, Montreal, Canada
It is fair to wait for the final report, but anyway I see the Martin's government is agonising. Canada needs fresh elections to get a new government which can work smoothly without all these unpleasant debates.
Maximiliano, San Jose, Costa Rica
The Conservative leader's lust for power really has blown up in his face. Canadians clearly did not want an election now and a majority are satisfied to wait until the inquiry into the scandals from the 90's is complete to pass judgement. In pushing for an election Mr Harper has exposed his ambition and alienated the progressive wing of the party which essentially makes him unelectable. The real scandal is the complete lack of a credible opposition party in this country.
Philip, Toronto, Canada
Philip from Toronto is on the mark when he states that the real scandal is the complete lack of a credible opposition party in this country. I have an immense quandary as a citizen in Canada. The Liberals deserve to be removed from office for their mismanagement as so far revealed by the Gomery Inquiry. However, I am equally repulsed by so many of the policies of the Conservative party that I could never vote for them. I want a fiscally well-managed government that is socially progressive. Where can I cast my vote?
Leonard Poole, Ottawa, Canada
I am an English speaking Quebecer. I am glad that the government survived the vote of non confidence. Although I abhor the scandal, I am disgusted at the Conservative party for putting this country's existence at stake. They aligned themselves with the separatist party (BLOC) to defeat the government not thinking about Canada but only for grabbing power.
Willie Bunter, Montreal, Canada
A few months ago, this country had an election and a minority government was chosen by the people of Canada. A minority government was chosen because Canadians are fed up with the arrogance of all of their politicians, no matter their political stripe! It is time now, for the House to get down to the business of discussing and passing bills...there are several that have been awaiting their attention. It is time to deal with the 'nitty gritty' parts of running this country. Get to it!
Diane Lea, Elliot Lake, Ontario, Canada
The old saying goes: "The more that things change, the more they stay the same". Our government system doesn't hold itself accountable for anything it does. The PCs pretty much messed everything up in the late 80's. The Liberals did the same in the 90's, and the Bloc have nothing else better to do, but stir up trouble. Everyone thinks this country is in great shape. Just by looking at this incident, we need a super-overhaul of the absolute mess we are running in.
Temujin, Richmond Hill, Ontario
I studied in Canada and as a student worked for the Grits, so I admit a bias, but I do think that the Conservative leader, Mr Harper, has betrayed whatever principles he had by going into alliance with the Bloc. The defection of Belinda Stronach to Liberals sends a very clear message that all is far from well amongst the Canadian Tories. Mr Harper has undermined his own leadership through a lack of moderation and impatience.
James, London, UK
I do not believe that an election should be held prior to the Gomery report. I also believe that Mr Harper has shot himself in the foot with his alliance with the Bloc. His credibility was never good but now it is permanently tainted.
Ernie Hawboldt, Port Williams NS, Canada