Malawi's veteran opposition politician, Gwanda Chakuamba, has announced that he is going to back the president in a shock U-turn after last month's polls.
Chakuamba had claimed that he was the rightful president
Under the accord, Mr Chakuamba has agreed to drop his legal challenge and will get a post in government.
The deal paves the way for President Bingu wa Mutharika to gain a majority in parliament, which his party lacks.
Mr Chakuamba had alleged fraud at the polls, which were criticised by international observers.
Following the announcement of the results, several people died in two days of protests led by Mr Chakuamba's supporters.
At the signing ceremony at former President Bakili Muluzi's house, Mr Chakuamba said that if one accepts democracy, one has to be prepared
to accept every eventuality.
Mr Chakuamba had previously agreed to form a united opposition parliamentary bloc with two other parties.
With 16 MPs from Mr Chakuamba's Republican Party and three from the Movement for Genuine Democratic Change, which signed the same deal, 74 MPs now back Mr Mutharika in the 193-seat parliament.
Bingu wa Mutharika, UDF: 35%
John Tembo, MCP: 27%
Gwanda Chakuamba, Mgwirizano: 26%
MCP: 59 seats
UDF: 49 seats
Mgwirizano: 27 seats
Independents: 38 seats
By-elections needed in 6 seats
Source: Malawi Election Commission
Many of the 39 independent MPs, who left Mr Mutharika's United Democratic Front, are expected to rejoin, to hand the president a majority.
The previously announced opposition alliance had been five seats short of a majority.
The leader of the opposition Malawi Congress Party, John Tembo said that Mr Chakuamba often performed similar U-turns.
"The rest of us will remain in opposition," he told the BBC's Network Africa programme.
"The government side has been enhanced by Chakuamba, obviously," he said.