The most senior court in the country concluded on Monday that Jack Phillips from Colorado was within his legal rights to turn down an order made by two men at his bakery in Lakewood in July 2012.
Writing on Twitter, Mr Graham said: "We thank God for answered prayer!
"Today the Supreme Court has ruled in favour of Jack Phillips, the Colorado baker who refused to create a wedding cake for a same-sex marriage ceremony.
"This is a huge win for religious freedom!"
Considering arguments made against Mr Phillips by the Colorado Civil Rights Commission, which took the case against him, a panel of judges ruled seven to two in his favour.
The decision was branded "wrong-headed" by senior politician and Democrat representative for San Francisco, Nancy Pelosi.
In a statement, she said: "The Masterpiece Cakeshop case is about the most fundamental right of all Americans: to be free from persecution and discrimination because of who they are or whom they love.
"While narrowly framed to apply to the decision-making process undertaken by the state commission, today's wrong-headed decision fails to uphold equality in this case."
Without commenting directly on the outcome of the case, US President Donald Trump tweeted: "Big Supreme Court ruling for Baker just out!"
Stay up to date with the latest news stories from a Christian perspective. Sign up to our daily newsletter and receive more stories like this straight to your inbox every morning.