The withdrawal agreement bill was given a second reading by 30 votes in a moment of triumph for the prime minister – seven months after Theresa May’s deal was thrown out for the third and final time.
But the prime minister's triumph was be short-lived, as MPs rejected his attempt to ram the legislation through the Commons in just three days in another crunch vote moments later.
Mr Johnson had earlier issued a dramatic threat to abandon the bill altogether and force a general election if MPs delayed Brexit until January, by forcing more debate.
With his hopes of leaving the EU at Halloween all but dead, Mr Johnson then announced he would "pause" the passage of the Brexit deal bill until the EU had made a decision on offering an extension.
Nevertheless, the second reading for the bill is a remarkable turnaround on the situation just a few weeks’ ago, when any deal appeared impossible.
Even when Mr Johnson caved into EU demands and abandoned his allies in the Democratic Unionist Party, by signing up to a customs border in the Irish Sea, he was expected to lose at Westminster.
But members of the hard-line European Research Group of Tory backbenchers also switched sides and enough Labour MPs defied Mr Corbyn to help get the deal over the line.
The so-called programme motion - setting out his planned timetable - was defeated by 322 votes to 308, prompting the government to shelve it and announce its intention to bring back debate on the Queen's Speech instead.
Mr Johnson told MPs: "I will speak to EU member states about their intentions. Until they have reached a decision we will pause this legislation."
He added: "Let me be clear. Our policy remains that we should not delay, that we should leave the EU on October 31 and that is what I will say to the EU and I will report back to the House.
"And one way or another we will leave the EU with this deal, to which this House has just given its assent."