The Liberal Democrats have caused a major upset in the Richmond Park by-election, overturning a 23,015 majority to oust ex-Tory MP Zac Goldsmith.
Mr Goldsmith stood as an independent after leaving the Conservative Party in protest at the government's decision to back a third Heathrow runway.
But Lib Dem Sarah Olney, who is also opposed to Heathrow expansion, fought the campaign on the issue of Brexit.
Labour's Christian Wolmar lost his £500 deposit as he trailed a distant third.
The other five candidates also lost their deposits as they did not receive a big enough share of the vote.
Ms Olney polled 20,510 votes to Mr Goldsmith's 18,638.
The Conservative Party, UK Independence Party and Green Party did not field candidates.
As the new Lib Dem MP for Richmond Park and North Kingston, Ms Olney will be the party's only female MP - joining eight male colleagues.
She said the by-election result was a rejection of the "politics of anger and division".
She added: "The people of Richmond Park and North Kingston have sent a shockwave through this Conservative Brexit government, and our message is clear - we do not want a hard Brexit.
"We do not want to be pulled out of the single market, and we will not let intolerance, division and fear win."
She said if Article 50 - the legal process that sparks Britain's exit from the EU - is put to a parliamentary vote, she will vote against it.
"That's been a central part of my campaign and now I've been given a very clear mandate that that's what they [constituents] want me to do," she told the BBC.
But the Conservative Party was quick to dismiss Ms Olney's view, stating: "This result doesn't change anything."
Liberal Democrat leader Tim Farron said the result "was a remarkable, come-from-nowhere upset that will terrify the Conservatives", but he claimed it was also a rejection of "a hard Brexit".
"This was not just about a Remain versus Leave rerun - this was about people trying to say to Theresa May, 'We do not like the extreme version of Brexit outside the single market you're taking us down,'" he told BBC Radio 4's Today programme.
"The other thing that was clearly a concern to voters was they desperately wanted a moderate, decent alternative to the Tories now Labour has shuffled off the main stage - and they were delighted to give the Liberal Democrats the opportunity to be just that."
Conservative MP Jacob Rees-Mogg conceded the vote had been about Brexit as Richmond "was a very strong pro-Remain constituency".
He praised Mr Goldsmith's "nobility" for keeping his word, but said it was a "real shame" that an independently minded person like him would no longer be in Parliament.
By Chris Mason, BBC political correspondent
In a year of political upsets, another.
Sarah Olney joined the Liberal Democrats only 18 months ago. She now becomes the party's ninth MP.
As soon as the polls closed last night, the width of Lib Dem smiles pointed to an extraordinary result.
A party of government shrivelled to a rump at last year's general election had rediscovered its mojo in this rich, pro-European corner of south-west London.
Zac Goldsmith had hoped this contest would be a referendum on the prospect of even more planes thundering through the skies here if Heathrow Airport gets bigger.
But, instead, it was June's EU referendum that dominated.
Seventy per cent of voters here backed Remain. But Zac Goldsmith didn't. The Liberal Democrats, unapologetically pro-EU, ruthlessly exploited this.
Sarah Olney told me she would vote against triggering Article 50 - the formal mechanism for starting Brexit.
But the country voted Leave, even if this seat didn't, and the government will press on regardless.
For Zac Goldsmith this was his second political humiliation of the year - beaten by Labour to be London Mayor, beaten by the Lib Dems in his own backyard. And leaving Theresa May's slender majority looking even thinner.
Guy Verhofstadt, the European Parliament's lead Brexit negotiator and chair of the Alliance of Liberals and Democrats, tweeted his good wishes to Ms Olney.
"Congratulations @sarahjolney1 and @LibDems. Europe is watching & we are proud #IamEuropean," he wrote.
Mr Goldsmith, who campaigned for Leave in the referendum, quit as the Tory MP for the constituency in October so he could fight a by-election as an independent on an anti-Heathrow Airport expansion ticket.
At the time, the Conservatives said they "disagreed" with Mr Goldsmith's decision but would not field a candidate against him.
Who is Sarah Olney?
A relative newcomer to politics, Sarah Olney said she was compelled to join the Liberal Democrats after the 2015 general election.
In her victory speech, she said: "A year and a half ago I wasn't involved in politics, I wasn't a member of a political party, I had never been involved in a political campaign, I had never thought about being a politician.
"But I knew I was a liberal.
"When I saw what happened in the general election last year I felt I had to get involved."
Ms Olney, who lives in North Kingston with her husband Ben and two children, works as a qualified accountant at the National Physical Laboratory in Teddington.
After his defeat was announced, Mr Goldsmith said: "This by-election was not a political calculation.
"It was a promise that I made and it was a promise that I kept.
"I wish Sarah well in her very, very important job and I hope she serves this community as well as this community deserves."
A Conservative Party spokesman said the result would make no difference to Brexit plans.
He said: "The government remains committed to leaving the European Union and triggering Article 50 by the end of March next year."
- Sarah Olney (Liberal Democrats) - 20,510
- Zac Goldsmith (Independent) - 18,638
- Christian Wolmar (Labour Party) - 1,515
- Howling Laud Hope (The Official Monster Raving Loony Party) - 184
- Fiona Natasha Syms, (Independent) - 173
- Dominic Francis Stockford, (Christian Peoples Alliance) - 164
- Maharaja Jammu and Kashmir (One Love Party) - 67
- David Powell - 32
Turnout = 53.6%
Ms Olney was elected with a majority of 1,872 votes, compared with a Conservative Party majority of 23,015 at the 2015 general election.