The Samajwadi Party on Saturday won the by-poll in Haidergarh assembly constituency.
SP nominee Arvind Singh Gope defeated his nearest Bahujan Samaj Party candidate Dharmi Rawat by a margin of 3,964 votes, sources said.
Gope got 40,497 votes and Rawat 36,533. BJP candidate Sunderlal Dixit was on third spot with 28,083 votes and the Congress' Imran Kidwai fourth with 4205.
The seat had fallen vacant following former Uttar Pradesh chief minister and Bharatiya Janata Party leader Rajnath Singh's resignation after his election to the Rajya Sabha.