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 sometime in the future, meaning it will go into effect next summer.
The debate lasted more than two hours Tuesday, 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. The Senate passed it an hour later.
"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.
The reaction to the news was immediate in the gay enclave of Boystown on Chicago's North Side.
The gay and lesbian community has been anticipating good news out of Springfield since May.
Mayor Rahm Emanuel was on hand, walking into bars and congratulating revelers who pouring champagne in celebration.
"Significant day when Illinois finally goes on record not just for marriage equality, but laws in line with values," Emanuel said.
Several couples took the opportunity to get engaged Tuesday night, knowing they could get married as soon as next summer in Illinois.
"Now we can get married like everyone else," said Chris Hill, who plans to marry his boyfriend as soon as he can.
"It's huge for our famiy, it's huge for our son. I can't tell you how it feels to be accepted, understood, vindicated, all of those things," Steve McDonough said.
More Chicago Stories: