Associated Press

Editor's note: The following was originally published in 2012 before the election between Mitt Romney and Barack Obama. In light of the tight race for the presidency between Donald Trump and Hillary Clinton, we take a look at the closest presidential races in U.S. history.

John Adams vs. Thomas Jefferson
Associated Press

Year: 1796

Electoral college tally: 71 to 68

Total/majority: 138/69

The election of 1796 pitted John Adams and the Federalist Party against Thomas Jefferson on the Democratic-Republican ticket. Under the current structure of government, the person with the next highest number of votes would become vice president. In this case, Jefferson beat out Federalist Thomas Pinckney and was named vice president, despite coming from the opposing party as the new president. The election, along with the election of 1800, led to the ratification of the 12th Amendment.

>> Thomas Jefferson (left) and John Adams (right)

John Adams vs. Thomas Jefferson
Associated Press

Year: 1800

Electoral college tally: 73 to 65

Total/majority: 138/70

In the 1800 election, Thomas Jefferson and John Adams faced off again, with Jefferson claiming 73 electoral votes and the presidency. However, prior to the ratification of the 12th Amendment, votes for the president and vice president were not listed on separate ballots. This led Jefferson and Aaron Burr to each received 73 electoral votes, despite coming from the same ticket. The question of which man would become president was sent to the House of Representatives, and it took 36 ballots to reach a majority decision. The 12th Amendment, ratified in 1804, was a move to rectify problems that arose in the 1796 and 1800 elections.

>> Thomas Jefferson (left) and John Adams (right)

James Madison vs. DeWitt Clinton
Associated Press

Year: 1812

Electoral college tally: 128 to 89

Total/majority: 217/109

The 1812 election, which took place in the shadow of the War of 1812, saw James Madison, the "Father of the Constitution" re-elected over opponent DeWitt Clinton, the "Father of the Erie Canal."

>> James Madison

John Quincy Adams vs. Andrew Jackson
Associated Press

Year: 1824

Electoral college tally: 84 to 99

Total/majority: 261/131

In the 1824 election, neither John Quincy Adams nor Andrew Jackson earned a majority of electoral votes. The decision went to the House of Representatives, which removed the fourth candidate from the ballot and voted between Jackson, Adams and William Crawford. The House voted to make Adams president, although Jackson led in both the popular vote and the electoral college vote. Four years later Jackson defeated Adams in the 1828 election, winning the electoral college 178 to 83.

>> John Quincy Adams (left) and Andrew Jackson (right)

Zachary Taylor vs. Lewis Cass
Associated Press

Year: 1848

Electoral college tally: 163 to 127

Total/majority: 290/146

Zachary Taylor, a Whig from Louisiana, defeated his Democratic opponent, Lewis Cass of Michigan, claiming 163 to 127 electoral college votes and the presidency. However, Taylor died on July 9, 1850. His vice president Millard Fillmore then assumed the presidency.

>> Zachary Taylor

1876: Rutherford B. Hayes vs. Samuel J. Tilden
Associated Press

Year: 1876

Electoral college tally: 185 to 184

Total/majority: 369/185

In the election between Rutherford B. Hayes and Samuel J. Tilden, Tilden won the popular vote, 4,288,191 to Hayes's 4,033,497. However, the electoral votes of four states were disputed. Congress referred the matter to the Electoral Commission, which chose to install Hayes as president.

>> Rutherford B. Hayes

Woodrow Wilson vs. Charles E. Hughes
Associated Press

Year: 1916

Electoral college tally: 277 to 254

Total/majority: 531/266

After defeating Theodore Roosevelt in the 1912 election, Woodrow Wilson won a second term by defeating Republican Charles H. Hughes, 277 electoral college votes to 254. Wilson claimed 9,126,063 popular votes to Hughes's 8,547,030.

>> U.S. President Woodrow Wilson and wife, first lady Edith Bolling Wilson attend the opening of the airplane mail service, May 15, 1918, in Washington, D.C..

1976: Gerald Ford vs. Jimmy Carter
Associated Press

Year: 1976

Electoral college tally: 297 to 240

Total/majority: 538/270

Democratic challenger Jimmy Carter defeated incumbent Gerald Ford in the 1976 election with 297 electoral votes, compared to Ford's 240 electoral votes. Carter also won the popular vote, 40,830,763 to 39,147,793.

>> President Gerald R. Ford chats with President Carter at the White House in Washington Tuesday, Dec. 20, 1977.

2000: George W. Bush vs. Al Gore
Associated Press

Year: 2000

Electoral college tally: 271 to 266

Total/majority: 538/270

In 2000, Democrat Al Gore won the popular vote in the election, with 50,992,335 votes to 50,455,156 votes for George W. Bush. Although Bush narrowly won the electoral college, 271 to 266, there was controversy over the awarding of Florida's 25 electoral votes. The close race triggered an automatic recount of ballots in Florida. After the Florida high court allowed hand recounts to proceed, the U.S. Supreme Court agreed to hear Bush's appeal. The Supreme Court ruled that the Florida Supreme Court's method for recounting ballots was a violation of the Equal Protection Clause of the 14th Amendment, which allowed the awarding of Florida's electoral college votes to Bush to stand.

>> President Bush, right, poses for a photo with former Vice President Al Gore, and other 2007 Nobel Prize recipients, not shown, Monday, Nov. 26, 2007, in the Oval Office of the White House.

2004: George W. Bush vs. John Kerry
Associated Press

Year: 2004

Electoral college tally: 286 to 251

Total/majority: 538/270

In another close race between President George W. Bush and his Democratic challenger, Bush claimed victory, 286 electoral votes to 251. In the 2004 race, Bush also won the popular vote, earning 62,040,610 votes to Sen. John Kerry's 59,028,444 votes.

>> Democratic presidential candidate John Kerry, left, and President George Bush shake hands prior to the start of the first presidential debate in Coral Gables, Fla. Thursday Sept. 30, 2004.