After a week of passionate debate at the Church of Canada's General Synod, members rejected a motion that would have allowed blessings on gay weddings.
More than 60 people spoke in the debate which ended in a secret vote of around 200 members.
The resolution required two-thirds support from each of three orders - the lay, clergy and bishops - to pass.
The bishops voted 68.42% in favour of the resolution and the lay delegates 72.22% in favour. But the clergy voted 66.23%, missing the percentage needed by a single vote.
"It is breaking my heart that there are people who see gay marriage as a separation from God and from love," said Eliot Waddingham, 24, a transgender person from Ottawa, who was an observer at the conference and worried that the vote was tantamount to a "death sentence" for the church.
"Woah. One vote," said the Rev Jeremy Smith in a tweet. "Prayers for all those wounded by the anti-LGBTQ vote."
Archbishop Colin Johnson of Toronto cited his own decades of marriage in arguing for the motion.
"I want my gay and lesbian colleagues to have the same joy," he said. "I believe it's the right thing to do."
Some speakers urged delegates to reject the resolution, with one saying it would cause "ghettos of resentment" if allowed, while several aboriginal delegates denounced it as condoning an "abomination" and disobedience of God.
Others said it was at odds with the Bible which is clear marriage is between one man and one woman.
"God did not create another Adam," said one speaker. "He created a woman."
There have also been complaints of bullying at private roundtable discussions on the issue, which are similar to the 'shared conversations' currently being held by the Church of England.
Archbishop Fred Hiltz urged respectful discussions: "Some members of our synod are deeply hurt. Some of them are deeply offended. Some are feeling unsafe to continue to speak lest they be reprimanded," he told the gathering.
"This kind of behaviour is not appropriate. It's unacceptable."
Currently the US Episcopal Church, the Anglican body in the United States, is the only one of the Anglican communion to permit gay marriage.
But other Anglican national churches in Brazil, South Africa, New Zealand and Scotland have taken steps towards accepting same-sex relationships.
Same-sex marriage has been legal in Canada since 2005 and the vote puts the Anglican Church - the third largest in Canada - out of step with most Canadians, including prime minister Justin Trudeau, who recently took part in a gay pride parade in Toronto.