WASHINGTON — The Senate approved complex health care legislation on Wednesday that would increase funding for disease research, address weaknesses in the nation’s mental health systems and vastly alter the regulatory system for drugs and medical devices. The vote sealed a final legislative victory for President Obama, who strongly supported the bill against objections from many liberal Democrats and consumer groups.

In many ways the bill, known as the 21st Century Cures Act, is a return to a more classic approach to legislation, with policy victories and some disappointments for both parties, and potential benefits for nearly every American whose life has been touched by illness, drug addiction and mental health issues. Years in the making, the measure passed 94 to 5 after being overwhelmingly approved by the House last week.

One major winner — and a donor to both parties — was the pharmaceutical industry; its role set off fierce but futile opposition by Senator Elizabeth Warren, Democrat of Massachusetts. On many of the areas addressed by the bill, pharmaceutical companies were in step with the interests of patients desperate for cures, an unusual and emotionally charged alliance between an industry and its consumers.

The bill was a test of Ms. Warren’s muscle, exercised from the far left of the Senate Democratic caucus, and it is one that did not go well. “I will fight it,” she said of the bill last week on the Senate floor, “because I know the difference between compromise and extortion.”