Historic measure becomes law with Gov. Quinn's signature.
Illinois is a governor's signature away from becoming the 15th state to allow gay marriages.
The Illinois Senate followed the House in approving same-sex marriage on Tuesday.
Gov. Pat Quinn, who was present for the vote, is expected to sign it into law.
Debate lasted more than two hours, and the final roll call was met with hearty cheers. Supporters' speeches echoed themes of equality and civil rights with mentions of Obama, Martin Luther King Jr. and Matthew Shepard, a gay college student whose 1998 death sparked hate crime bills.
The bill passed the House 61-54, barely obtaining the 60 votes needed for passage.
"At the end of the day, all we're talking about is treating every family in the state of Illinois with the same equality and justice under the law as others," bill sponsor Rep. Greg Harris said.
House Speaker Mike Madigan appeared to the one who tipped the scales. Madigan quoted Pope Francis in explaining his support of the bill.
"Who am I to judge that they should be illegal? Who is the government to judge that they should be illegal, and for me, that's the reason to support this bill," Madigan said.
Rep. Thomas Morrison urged a no vote during the debate to "protect the institution of marriage" and "strengthen and protect real marriage." Rep. Jeanne Ives called it "the worst bill in the country."
The vote comes after supporters of gay marriage rallied at the state capitol to encourage House leaders to approve the measure after a disappointing spring session.
The measure initially failed to pass the Illinois House when the regular session ended in May. It was approved by the state's Senate on Valentine's Day, but a lack of votes kept it stalled in the House. The bill has been supported by Mayor Rahm Emanuel, Quinn, Sen. Mark Kirk and President Barack Obama who exhorted legislators during a Chicago visit to approve the measure.
Obama, who once served in the Illinois state Senate, released a statement saying he was "overjoyed for all the committed couples in Illinois."
The president commended members of the Legislature for approaching the issue in an "open and fair way." He says the nation's journey is not complete until gay men and women are treated equally under the law.
The Illinois Catholic Conference issued a statement saying they are "deeply disappointed" with the decision.
"We remain concerned about the very real threats to religious liberty that are at stake with the passage of this bill," the statement read.
Fifteen states now have laws on the books supporting gay marriage, plus Washington, DC.
Illinois approved civil unions in 2011.