MPs have voted by 413 to 202 – a majority of 211 – for Prime Minister Theresa May to ask the EU for a delay to Brexit.
It means the UK may not now leave on 29 March as previously planned.
Mrs May says Brexit could be delayed by three months, to 30 June, if MPs back her deal in a vote next week.
If they reject her deal again then she says she will seek a longer extension – but any delay has to be agreed by the 27 other EU member states.
Most Conservative MPs voted against delaying Brexit – including seven cabinet members – meaning Mrs May had to rely on Labour and other opposition votes to get it through.
Theresa May has long insisted that the UK will leave the EU on 29 March with or without a withdrawal deal.
But she was forced to offer MPs a vote on delaying Brexit after they rejected her withdrawal agreement by a large margin, for a second time, and then voted to reject a no-deal Brexit.
She has warned that extending the departure date beyond three months could harm trust in democracy – and mean that the UK would have to take part in May’s European Parliament elections.
Downing Street said the government was still preparing for a no-deal Brexit.
Theresa May is planning to hold another “meaningful vote” on her withdrawal deal by Wednesday – after it was overwhelmingly rejected on two previous occasions.
She then plans go to an EU summit on Thursday, where she would ask for a one-off extension to get the necessary legislation through Parliament.
A spokesman for the European Commission said extending Article 50, the mechanism taking the UK out of the EU on 29 March, would need the “unanimous agreement” of all EU member states.
And it would be for the leaders of those states “to consider such a request, giving priority to the need to ensure the functioning of the EU institutions and taking into account the reasons for and duration of a possible extension”.
Downing Street said this was a “natural consequence” of Mrs May’s decision to offer a free vote on an issue where there are “strong views on all sides of the debate”.
Chief Secretary to the Treasury Liz Truss tweeted: “I voted against a delay to Brexit. As a delay was passed by Parliament, I want to see deal agreed ASAP so we can minimise to short, technical, extension.”
Seven cabinet ministers – Ms Truss, Brexit Secretary Stephen Barclay, International Trade Secretary Liam Fox, International Development Secretary Penny Mordaunt, Commons leader Andrea Leadsom, Transport Secretary Chris Grayling and Defence Secretary Gavin Williamson – voted against the government motion.
Health Secretary Matthew Hancock said it would be “extremely difficult” but “still possible to deliver Brexit on 29 March with a deal”.
He said there were now two options: “to vote for the deal and leave in orderly way or a long delay and I think that would be a disaster.”
MPs earlier rejected an attempt to secure another Brexit referendum by 334 votes to 85.
And they also rejected a cross-party plan, to allow MPs to take control of the Brexit process to hold a series of votes on the next steps, by the narrow margin of two votes.
Following the votes, Labour leader Jeremy Corbyn reiterated his support for a further referendum after earlier ordering his MPs not to vote for one.
He said: “Today I reiterate my conviction that a deal can be agreed based on our alternative plan that can command support across the House.
“I also reiterate our support for a People’s Vote – not as a political point-scoring exercise but as a realistic option to break the deadlock.”
Labour abstained when MPs voted on the referendum proposal, tabled by Independent Group MP Sarah Wollaston, arguing that now was not the right time to push for a public vote.
Labour’s plan to delay Brexit to allow Parliamentary time for MPs to “find a majority for a different approach” was defeated by 318 to 302 votes.