WASHINGTON—The Supreme Court dramatically advanced gay rights Wednesday in rulings that direct the federal government to provide equal treatment to same-sex spouses and allow the resumption of gay marriages in California.

In a pair of 5-4 rulings on the final day of the court's term, the justices struck down the 1996 Defense of Marriage Act, which denied federal benefits to gay couples married under state law, and let stand a ruling that found Proposition 8, a 2008 voter initiative that ended same-sex marriage in California,...