The amendment to Bill 10 passed 38-17, with only three Progressive Conservative backbenchers voting against it.
The opposition Wildrose, Liberal and NDP parties also voted against it.
The amendment stipulates that if a school disallows a gay-straight alliance, the government would create one for students, but it does not mandate that the club be on school grounds.
Opposition politicians said forcing the alliances off-site is stigmatizing and humiliating.
NDP member Brian Mason told the house it's a revival of the reviled "separate but equal" Jim Crow laws used more than a generation ago in the U.S. to segregate and degrade African-Americans.
"It's institutionalized apartheid of gay students," said Mason during a heated and at times emotional debate.
The Tories argued back that just because the schools could move the clubs off school grounds doesn't mean they will.
"Our end goal here is very simple," said PC backbencher Sandra Jansen, who sponsored the bill.
"We are trying to make sure that every child in every school in this province has the opportunity to take part in a (gay-straight alliance).
"To go to a place where you bring up terms like segregation is very unhelpful to this conversation."
The amendment was introduced by the PCs to try to recapture the political initiative on an issue that is growing to symbolize how Alberta views and treats homosexuals.
Gay-straight alliances are after-school clubs made up of gay students and their classmates to help gay students feel welcome and to prevent them from being abused and bullied. Statistics in other jurisdictions show the rate of suicide among gay youth drops significantly when a school has a GSA.
GSAs operate with no problem in many public schools in Edmonton and Calgary, but the Liberals say there are none in rural or faith-based schools. Liberal Laurie Blakeman has said Catholic school officials are blocking GSAs in their facilities.
Tony Sykora, head of the Alberta Catholic School Trustees Association, told the CBC on Wednesday that they did express concerns on Bill 10 to the province and would prefer broader diversity groups to GSAs.
The Tories came up with Bill 10 this week as a replacement to an opposition private member's bill that would order all schools to set up GSAs if students wish them.
Bill 10 does not give students the right to set up the GSAs. In its original wording, if a school said no, students could appeal to the school board with final recourse to the courts. Wednesday's amendment gives the province the final word.
That has led to a firestorm of criticism, splintering the ranks of Tory supporters.
Premier Jim Prentice, who is away this week, has allowed his caucus members to vote their conscience, and on Wednesday the ranks of dissenters grew.
PC backbencher Thomas Lukaszuk said Bill 10 has become one of the defining moments in the province's history and a chance for politicians to tell the world what Alberta stands for.
PC backbencher Doug Griffiths said schools are there to teach, not judge.
"There is no way I would accept a school board of any religious background or non-religious background to dictate to my sons whether or not they’re allowed to partner with gay students to set up a gay-straight alliance," said Griffiths.
Griffiths, Lukaszuk and Ian Donovan were the only PCers to vote against the amendment.
The bill has been criticized by other Tories outside the chamber and by members of the public.
Josh Traptow, the president of the Calgary-Bow PC association, resigned Wednesday in protest of Bill 10.
The Tories have been skewered on social media as backward hillbillies. One cartoon has gone viral depicting the inside of a descending airplane. The captain, over the intercom, welcomes passengers to Alberta "where the local time is 1963."
In Calgary, Stampeders star running back Jon Cornish said as a victim of racial discrimination, he can't abide any legislation that separates and diminishes people.
Cornish told reporters that the Canada he knows is better than Bill 10.
"Canada is a progressive, thoughtful nation," he said. "Stuff like (Bill 10) I think is just an anomaly in our overall progress."Suggest a correction