The church's ruling body voted Saturday by 326 to 267 to support the appointment of the Rev. Scott Rennie, 37, who was previously married to a woman and is now in a relationship with a man.
Rennie was first appointed as a minister 10 years ago, but has faced opposition from some critics since he moved to a church in Aberdeen, Scotland, last year.
The case threatens to divide Scottish religious leaders and follows tensions within the worldwide 77 million-member Anglican Communion. About 900 elders and ministers took part in a debate on Rennie's case, but many chose to abstain from casting a vote.
Anglican have conducted lengthy debate over sexuality issues since the Episcopal Church - the Anglican body in the U.S. - consecrated the first openly gay bishop, V. Gene Robinson of New Hampshire in 2003.
Rennie said he believed religious conservatives were behind attempts to oust him from his post. "The same talk was about when women were ordained and I think that argument suits those that don't want any change," he told Britain's Sky News television on Saturday.
Following the vote to back Rennie, Scotland's Equality and Human Rights Commission said the Church of Scotland had proven itself to be "a modern church for a modern Scotland."
Protesters had lobbied the Kirk - the Church of Scotland's ruling executive - over Rennie's case, saying his appointment was not consistent with the teachings of the Bible.
"We are absolutely opposed to that on the basis of what God has to say about homosexuality in the Bible," one opponent, Pastor Jack Bell of the Zion Baptist Church in Glasgow, Scotland, said.