The high court ruled for the bakery; however, it was a very narrow ruling that did not touch the issue of anti-LGBT discrimination. Indeed, the court's language all but said that secondary status for LGBT persons in these disputes was not allowable.
As the Los Angeles Times observed in a well-written news article (link here) on the decision: The Court "emphasized the importance of equal rights for gays and lesbians, and it largely rejected the claim that store owners have broad religious liberty rights to turn away customers because of their sexual orientation. Although some may object to same-sex marriages, said Justice Anthony M. Kennedy, 'it is a general rule that such objections do not allow business owners and other actors in the economy and in society to deny protected persons equal access to goods and services under a neutral and generally applicable public accommodations law.'"
The court ruled as it did in this case because of the way the particular bakeshop had been treated when the matter was originally before the state.
Nonetheless, religous zealots almost immediately and falsely claimed this ruling was a huge win for their side and that anti-LGBT business practices were constitutional. The high court, however, made it very clear if another case comes before them soon, they will rule on the side of LGBT rights.
Hopefully the latter will happen and establish landmark protections for all LGBT Americans.