The vote was triggered when the incumbent Labour lawmaker was ousted by her constituents in a recall petition.
Labour candidate Lisa Forbes won with 10,484 votes, a majority of 683 over the Brexit Party that came second on 9,801 votes.
WATCH: May 27 — Brexit Party leader Nigel Farage wins EU parliament seat
Prime Minister Theresa May’s governing Conservatives came third with 7,243 votes.
The Brexit Party, launched in April, swept to victory in the United Kingdom’s European Parliament election last month, riding a wave of anger over May’s failure to deliver Britain’s exit from the European Union on time and the impasse in parliament over the way forward.
It was the bookmakers’ favourite to win in Peterborough, which supported Brexit by 61 per cent to 39per cent in the 2016 referendum.
“Despite differing opinions across our city, the fact that the Brexit Party have been rejected here in Peterborough shows that the politics of division will not win,” Labour’s Forbes said in her victory speech.