Hayes barely won the election of 1876 , only defeating Democratic opponent Samuel Tilden after a Congressional committee gave Hayes some disputed electoral votes . In 1876 , Hayes was elected president in one of the most contentious and hotly disputed elections in American history . Although he lost the popular vote to Democrat Samuel J. Tilden , Hayes won the presidency by the narrowest of margins after a Congressional commission awarded him twenty disputed electoral votes .