WASHINGTON—Chief Justice John Roberts joined the Supreme Court's four liberals Thursday to uphold the linchpin of President Barack Obama's plan to expand health coverage to nearly all Americans, a surprise conclusion to a constitutional showdown.

The ruling clears the way for the biggest revamp of America's health-care system since the 1960s—and sets the stage for a renewed political fight over its merits.

By...