Labour's Emma Lewell-Buck has won the South Shields parliamentary by-election, with the UK Independence Party (Ukip) coming second.
She beat Ukip's Richard Elvin by 6,505 votes in the contest triggered by former foreign secretary David Miliband's decision to quit.
The Conservatives finished in third, but the Liberal Democrats were pushed down to seventh place.
The Labour winner, a married social worker, was cheered by supporters as she became the first female MP in South Shields.
From the podium, she said: "I will help get people back to work, champion our wonderful town and never give the Tory Government one moment's peace."
Mr Miliband congratulated his successor in a message on Twitter. "Congrats @EmmaLewellBuck and Labour team in #southshields. Holding 50% of vote very good result."
Afterwards Ukip candidate Richard Elvin said: "It's an absolutely fantastic result for Ukip. To come from nowhere to take 25% at its first attempt is absolutely stunning.
"It's a message to all three mainstream parties that Ukip is the official opposition. We have proved that in Labour strongholds and we have done it again in South Shields."
After the win, the new MP said: "Ukip did make inroads but ultimately the people of South Shields have spoken and they want a Labour MP."
She added: "I have seen how people live under a coalition Government and are really struggling, and I want to make a difference."