By Hannah Hennessy
BBC News, Lima
Peru's Prime Minister Carlos Ferrero and also Defence Minister Roberto Chiabra have survived a censure motion in parliament.
Around 200 rebels took part in the uprising
The opposition wanted to sack them over their handling of an uprising by former soldiers earlier in January, in which six people died.
But the motion failed to get the 61 votes needed to remove the ministers.
However, the vote is seen as deeply embarrassing for Peru's unpopular President Alejandro Toledo.
The motion against the prime minister was backed by 43 members of congress - more than the 42 who opposed it, but a number of MPs abstained.
President Toledo consistently gets low approval ratings
Forty-one voted to censure the defence minister, with 44 rejecting the motion.
Not all of those who could have voted did.
Opposition politicians argued that the two ministers were politically responsible for failing to prevent the uprising when around 200 ex-army nationalists stormed a police station and demanded the resignation of Mr Toledo.
The vote may bring some temporary relief to the president.
But analysts say the beleaguered president may be forced to reshuffle his cabinet in the next few days to avoid further criticisms or allegations against members of his government.
Last week, his interior minister resigned over the uprising, easing pressure on the president.
But not for long.
Then, the president's sister was placed under house arrest, accused of overseeing the mass falsification of signatures needed to register his political party for elections in 2000.
She denies the allegations.
Mr Toledo lost those elections, but when he came to power in 2001 he did so with massive popularity and the promise to stamp out the corruption of the previous government.
Now - with 18 months left in power and around 8% support according to recent polls - the president has a lot of ground to make up.
A cabinet reshuffle may help boost his support for now.