The bill's sponsor, Sen. Heather Steans, D-Chicago, called it "a vote for the history books."
"We have the opportunity today to welcome all families in Illinois as equally valued," she said.
Before approving the measure, the Senate attached an amendment Thursday that explicitly states no church or other religious organization will be forced to solemnize same-sex marriages. It also says churches cannot be sued if they don't allow their parishes to be used for same-sex marriage ceremonies.
Some Republicans raised concerns that the bill would force religious organizations to allow same-sex marriage ceremonies in their fellowship halls, parish centers or even in their sanctuaries. Steans said even before the amendment was added that the bill made clear churches won't be forced to perform same-sex marriages.
Sen. Jason Barickman, R-Champaign, was the only Republican to vote yes. He said he worked with Steans on the amendment before pledging his support.
"I think it was the right thing to do," Barickman said. "It's a vote that I understand some have varying opinions on, but I feel that I voted in the correct way."
The Valentine's Day vote marked the first time gay marriage has passed on the floor of either chamber of the Legislature. Steans and other supporters tried to pass it during the January lame duck session. But after getting approval from a Senate committee, Steans opted not to call for floor action, saying it didn't have enough votes.
After picking up seats in November, Democrats entered the current legislative session with control of 40 seats in the Senate, where 30 votes are required to advance most measures. The Senate Executive Committee approved the gay marriage bill on a party-line vote last week, setting up the Valentine's Day floor action.
Jim Bennett, regional director for Lambda Legal, said supporting same-sex marriage is "both politically smart and morally right."
Polls show voters' feelings shifting rapidly in favor of gay rights. President Barack Obama said last year he supports same-sex marriage, and in November voters in four states either approved or voted down bans on gay marriage.
"I think it's a safer vote to vote with us than to vote against us at this point," Bennett said.
The issue has caused internal conflict among Republicans as the party works balance its efforts to appeal more to younger voters, minorities and women with the more socially conservative positions of some members.
After Illinois GOP Chairman Pat Brady announced his support for gay marriage during the lame-duck legislative session, saying it was a civil rights issue, some Republicans called for his ouster. Opponents of gay marriage pledged to fund primary challenges to any Republican who voted in favor of the bill.
Thursday's vote came two years after Illinois lawmakers approved civil unions, which provide legal recognition of a partnership between two people, regardless of gender. But gay marriage supporters said it wasn't enough.