"What a day for Minnesota," Dayton said at the signing ceremony held on the steps of the state Capitol in St. Paul. "And what a difference a year and an election can make."
The signing followed 37-30 vote by the Minnesota Senate Monday to legalize same-sex marriage after a 75-59 approval by the state House last week.
Several thousand people gathered in front of the Minnesota Capitol to witness Dayton sign the document that means same-sex marriage will become legal Aug. 1.
"I wanted my kids to experience history, to take in and breathe in the equality in the air," said Laurie Wenker, who was among the crowd with her children Eleanor, 16, and Lillian, 13. "We were talking on the car ride here and Lillian said to me, 'My kids will never know a world where people weren't allowed to marry the person they love.' That's so true."
Not everyone on hand viewed the new law as a good thing.
"The Bible is quite clear -- one man, one woman," said Mark Winiecki, 63, of Hugo, who showed up to urge people to vote out Democrats in next year's elections.
But Kyle Hanson of Minneapolis, who danced with his daughter Sofie, 6, as his husband, John Stumme, danced with their son Henry, 3, in downtown St. Paul, called it "a huge day for our family."
"We are finally equal with other families," he said.
The couple intends to officially get married in Minnesota in August.
Three Senate Democrats -- LeRoy Stumpf, Dan Sparks and Lyle Koenen -- voted against the measure. One Republican, Sen. Branden Petersen, voted for it.
Last week four House Republicans voted to allow same-sex marriage while two House Democrats voted no.
Opponents said the bill was a Pandora's box with severe and far-reaching consequences.
"Where does this stop?" asked Republican Sen. Torrey Westrom of Elbow Lake. Supporting same-sex marriage sends Minnesota "down that road of taking mother and father out of our recognition of what our children need."
Republican Sen. Dan Hall of Burnsville said he prayed right up till the end for a miracle and the Senate to reject the bill.
"Some people have said that they are concerned about being on the right side of history. I am more concerned about being on the right side of eternity," the Minneapolis Star Tribune quoted him as saying.
Minnesota joins 11 other states in which same-sex marriage is legally recognized: Connecticut, Delaware, Iowa, Maine, Maryland, Massachusetts, New Hampshire, New York, Rhode Island, Vermont and Washington.
Maine, Maryland and Washington legalized same-sex marriage through popular vote in November.
The District of Columbia and three American Indian tribes have also legalized same-sex marriage.
California, which briefly granted same-sex marriages in 2008, now recognizes them on a conditional basis.