The historic vote on the first day of this year's gathering in Edinburgh draws a line under a row which has split the Kirk for nine years.
Commissioners voted by 339 votes to 215 in favour of the move. The decision means that same sex civil marriage will be permitted for ministers.
However, they will not themselves be allowed to conduct gay weddings within the church.
Last year, the assembly agreed that ministers could enter into civil partnerships.
The Very Rev John Chalmers, principal clerk to the General Assembly, said: "We had a debate which made very clear that we were not interfering with our theological definition of marriage and were not going to the place where ministers or deacons could themselves be conducting same-sex marriages.
"It is an entirely different discussion.
"Today's decision means it will be possible for Kirk sessions and congregations to depart from the traditional understanding of marriage to call not only potentially a minister in a civil partnership but one who is in a same-sex marriage.
"In some ways we crossed the Rubicon last year when it was agreed that Kirk sessions could call someone in a civil partnership and for many people what today was about was simply tidying up and making the law of the church consistent with Scots law."
He added: "Today I think people came to this decision with their minds on law and practice and not on theology and future practice."
The decision means the Kirk adopts a position which maintains a traditional view of marriage between a man and woman, but allows individual congregations to "opt out" if they wish to appoint a minister or a deacon in a same-sex marriage or a civil partnership.
Any wider consideration of the theological understanding of same-sex marriage will not take place until the Theological Forum presents its report to the Kirk next year.
These latest changes will differentiate the church from the Church of England, which bans clergy from being married to partners of the same sex and does not allow gay church weddings.