Gloria Arroyo has won a fresh term as Philippines president, according to a vote-count finally completed six weeks after the election.
It is the first time Arroyo has won a popular mandate
A congressional committee tasked with the contentious count declared Ms Arroyo the winner by one million votes.
Mrs Arroyo beat film star Fernando Poe Junior to win her first electoral mandate since she assumed the presidency in 2001.
The opposition had accused Mrs Arroyo's camp of widespread irregularities.
The army and police have been put on alert for trouble.
There was applause from lawmakers and the audience as the congressional committee announced Mrs Arroyo's victory on Sunday.
According to the count, Mrs Arroyo, 57, received 12,905,808 votes - just over a million more than Mr Poe.
"The canvass is over. Arroyo has won," Senate President Franklin Drilon said.
Opposition accusations of fraud had dogged the vote tally
"It was very difficult but this is democracy," he said. He described the drawn-out count as "harrowing".
Mrs Arroyo's spokesman said she was planning to hold celebration street parties in the Cebu area, where she has strong support.
"The orderly processes set by our laws have ensured that the will of the people has prevailed," said Arroyo spokesman Ignacio Bunye.
The result paves the way for Mrs Arroyo to be sworn in before the end of June - though Mr Poe still has the power to file a complaint to the Supreme Court election tribunal.
In a statement, Mr Poe's party accused pro-Arroyo legislators of preventing the opposition from presenting evidence of massive fraud.
"This is a sad time in the history of our country,"
Mr Poe's party said in a statement.
"What the majority in Congress has done is to abort the truth in the womb of our sacred electoral process."
Mr Poe had previously declared himself the winner, accusing Mrs Arroyo's camp of vote-buying and harassment of voters.
Protest put down
The cross-party vote count was slowed by persistent demands from opposition lawmakers that copious electoral records from small villages be opened to check allegations of fraud.
Poe's film-star appeal made him a serious contender
Two opposition legislators walked out of the committee before the tally was completed, but it went ahead anyway.
Police used water cannon and truncheons to disperse up to 1,500 pro-Poe protesters marching on the presidential palace on Friday.
The crackdown sparked accusations from Mrs Arroyo's opponents that her rule was reminiscent of martial law.
But Mrs Arroyo defended her government's actions
against what her spokesman called "agents of
The potential for unrest cannot be taken lightly in the Philippines, after two "people power" uprisings and at least nine coup attempts in the last 18 years, correspondents say.
Mrs Arroyo herself took over midway through the term of President Joseph Estrada after a popular revolt against his rule in January 2001.
She has only now secured an electoral mandate for her presidency.