Nigel Farage’s right-wing populist party snatched a battleground parliamentary seat from the governing Labour Party, winning by just six votes.