It means the 14 states with bans on same-sex marriage will no longer be able to enforce them.
Justice Anthony Kennedy wrote that the plaintiffs asked “for equal dignity in the eyes of the law. The Constitution grants them that right.”
The ruling brings to an end more than a decade of bitter legal battles.
Same-sex couples in several affected states including Georgia, Michigan, Ohio and Texas rushed to wed on Friday.
However officials in some states including Mississippi and Louisiana said marriages had to wait until procedural issues were addressed.
President Barack Obama said the ruling was a “victory for America”.
“When all Americans are treated as equal, we are all more free ” he said.