Sonia Kumar is elected as the MP for Dudley, taking the seat from Conservative Marco Longhi, who was elected for Dudley North in 2019.
Ms Kumar, an NHS physiotherapist, got 12,215 votes, while incumbent Longhi received 10,315 – a 34.3% loss in vote share.
The Reform UK candidate, Andrew Southall, came in third with 9,442 votes.
Ms Kumar previously said she was shocked and disappointed by a “divisive” letter Mr Longhi sent to British Pakistani voters in the constituency, in which he underlined Kumar’s surname.
Critics claimed this was to point out Ms Kumar’s British Indian background in the hope of persuading British Pakistani Muslims not to vote for her.
Mr Longhi denied trying to stoke division.