The Same Sex Marriage Bill was adopted 105-18, the Scotsman reported. Both support and opposition crossed party lines with Cabinet ministers among those voting no.
Most religious groups, including the Church of Scotland, opposed the measure. The bill allows religious groups and individual clerics to decide whether to perform same-sex weddings and protects them from discrimination claims if they refuse, but there was a push for stronger protection, which was voted down.
"The Church of Scotland holds to the mainstream Christian belief that marriage is properly between a man and a woman," Alan Hamilton, convenor of the legal questions committee, said.
Officials said the first same-sex weddings are almost certain to be held by the end of the year. Scotland has recognized civil unions since 2005.
"Today is a momentous day for equality in our nation," Health Secretary Alex Neil said. "This legislation sends a powerful message to the world about the kind of society we in Scotland are trying to create -- a nation where the principles of fairness and equality are weaved into the very fabric of our society."
Scotland is the 17th country to legalize same-sex marriage and leaves Northern Ireland as the only holdout in the United Kingdom.
Notable deaths of 2014 [PHOTOS]