The 5-3 ruling held that the Republican-backed 2013 law placed an undue burden on women exercising their constitutional right to end a pregnancy established in the landmark 1973 Roe v. Wade decision. The normally nine-justice court was one member short after the Feb. 13 death of conservative Justice Antonin Scalia, who consistently opposed abortion in past rulings.
Conservative Justice Anthony Kennedy joined liberal members of the court in ruling that both key provisions of the law violate a woman's constitutional right to obtain an abortion.
Liberal Justice Stephen Breyer, writing for the court, said that the appeals court that upheld the law was wrong in its approach, noting that courts are required to "consider the burdens a law imposes on abortion access together with the benefits that those laws confer."
Deferring to state legislatures over "questions of medical uncertainty is also inconsistent with this court's case law," Breyer added.
Three conservative justices - Chief Justice John Roberts, Justice Clarence Thomas and Justice Samuel Alito - dissented.
By setting a nationwide legal precedent that the two provisions in the Texas law were unconstitutional, the ruling imperils laws already in place in other states.
Texas had said its law, passed by a Republican-led legislature and signed by a Republican governor in 2013, was aimed at protecting women's health. The abortion providers had said the regulations were medically unnecessary and intended to shut down clinics. Since the law was passed, the number of abortion clinics in Texas, the second-most-populous U.S. state with about 27 million people, has dropped from 41 to 19.
Democratic President Barack Obama's administration supported the challenge brought by the abortion providers.
The Texas law required abortion doctors to have "admitting privileges," a type of formal affiliation that can be hard to obtain, at a hospital within 30 miles (48 km) of the clinic so they can treat patients needing surgery or other critical care.
The law also required clinic buildings to possess costly, hospital-grade facilities. These regulations covered numerous building features such as corridor width, the swinging motion of doors, floor tiles, parking spaces, elevator size, ventilation, electrical wiring, plumbing, floor tiling and even the angle that water flows from drinking fountains.
"We conclude that neither of these provisions offers medical benefits sufficient to justify the burdens upon access that each imposes," Breyer wrote in the ruling. "Each places a substantial obstacle in the path of women seeking a pre-viability abortion, each constitutes an undue burden on abortion access, and each violates the federal Constitution."
Alito said in his dissenting opinion that the court should have upheld the law on a legal technicality. He criticized the majority, saying that in striking down the law, the court "simply disregards basic rules that apply in all other cases."
The last time the justices decided a major abortion case was nine years ago when they ruled 5-4 to uphold a federal law banning a late-term abortion procedure.
Abortion rights supporters hailed the ruling.
Amy Hagstrom Miller, founder and CEO of Whole Woman’s Health, which led the challenge to the Texas law, said, "Every day Whole Woman’s Health treats our patients with compassion, respect and dignity - and today the Supreme Court did the same. We’re thrilled that today justice was served and our clinics stay open."
Presumptive Democratic presidential nominee Hillary Clinton on Twitter called the ruling "a victory for women in Texas and across America."
"This fight isn't over: The next president has to protect women's health. Women won't be 'punished' for exercising their basic rights," she said, a dig at presumptive Republican presidential nominee Donald Trump, who once suggested women who get illegal abortions should face "some sort of punishment." The presidential election is Nov. 8.
Abortion opponents denounced the ruling.
"It's exceedingly unfortunate that the court has taken the ability to protect women’s health out of the hands of Texas citizens and their duly-elected representatives," Texas Attorney General Ken Paxton, a Republican, said in a statement.
Republican Texas Lieutenant Governor Dan Patrick added that abortion clinics are now "free to ignore these basic safety standards and continue practicing under substandard conditions. By its ruling, the court held that the ability of abortion clinics to remain open – even under substandard conditions –outweighs the state’s ability to put women’s health and safety first."
Some U.S. states have pursued a variety of restrictions on abortion, including banning certain types of procedures, prohibiting it after a certain number of weeks of gestation, requiring parental permission for girls until a certain age, imposing waiting periods or mandatory counseling, and others.
Americans remain closely divided over whether abortion should be legal. In a Reuters/Ipso online poll involving 6,769 U.S. adults conducted from June 3 to June 22, 47 percent of respondents said abortion generally should be legal and 42 percent said it generally should be illegal.
Views on abortion in the United States have changed very little over the decades, according to historical polling data.