Pakistani Prime Minister Imran Khan on Saturday won a vote of confidence in the lower house of Parliament, the speaker said.
Khan won 178 votes in the 341-seat National Assembly, well above the 172 votes he needed to survive.
On Wednesday, Khan announced to seek a vote of confidence from Parliament after his party's unexpected defeat on a key Senate, upper house, seat from the capital Islamabad.
Yousaf Raza Gilani, a joint candidate of the opposition alliance, won the seat in an embarrassing upset.
The ruling party candidate, Hafeez Shaikh, lost despite having majority in the National Assembly -- which indicates the prime minister's own aides voted for the opposition candidate.
Members of the National Assembly choose senators from Islamabad for a period of six years in a secret ballot.