Labour have gained the Colne Valley constituency from the Conservatives.
Thelma Walker took 28, 818 votes, over the Conservative incumbent Jason McCartney, who gained 27,903.
McCartney had held the seat since 2010 and earlier this week was given a 99% chance of retaining the seat by Betfair.
The constituency has long been considered a three-way marginal seat, having been held by each of the three main parties in the last 40 years.
The area is largely rural but includes the outskirts of Huddersfield.
The seat was once held by Independent Labour MP Victor Grayson, who went missing in mysterious circumstances in 1920.