BOSTON, SEPT. 18 -- A surge of independent voters pushed William F. Weld to victory today as the Republican nominee for governor in Massachusetts, and a revolt against the political establishment lifted Democrat John R. Silber to a stunning upset over Francis X. Bellotti.

Silber, the blunt-spoken president of Boston University, came from behind in late-summer polls to defeat Bellotti, the state's former three-term attorney general and a fixture in Democratic politics for a generation.

The results stemmed from what pollsters described as a wave of anger among voters that grew out of the state's fiscal crisis and toppled incumbents across the political landscape. In both gubernatorial primaries, victory went to the candidates who succeeded in defining themselves as political "outsiders."

Looming in the Nov. 6 general election for Weld and Silber is a certain dispute over a citizen-petitioned ballot measure to repeal a $1.8 billion state tax increase and roll back state fees to 1988 levels. Weld supports the petition; Silber opposes it.

In his victory speech, Silber, a pro-business, fiscal conservative, promised "an end to patronage and waste in state government" and a solution to the state's chronic budget deficits.

"Men and women who work hard and pay taxes have a right to a government that works," Silber told his cheering and surprised supporters.

Bellotti attributed his loss to "a mood out there" that demanded change. "It was kind of a protest," he said. "It was like a revolt. I accept that."

The results also raised questions about the state parties' role in endorsing candidates. Both Weld and Silber were rejected by their parties' conventions earlier this year.

Weld's appeal among independents, who were eligible to vote in either primary, helped him overtake the summertime front-runner, House Minority Leader Steven Pierce, who had his party's endorsement.

Weld, the former federal prosecutor in Boston and former head of the Justice Department's Criminal Division, overcame a gap of as much as 35 percentage points in some polls.

Silber, making his first run for public office with an insurgent campaign, attracted many conservative Democrats and independent voters. He tapped a wave of voter anger at the state's Democratic establishment, which is being blamed for raising taxes and running a deficit.

Bellotti, who served three terms as state attorney general and defeated Weld in the 1978 attorney general's race by a landslide, sought the gubernatorial nomination after four years in private law practice and tried to present himself as the candidate of "change."

The race for governor, on which candidates have spent nearly $9 million so far, drew the most public attention this political season. Gov. Michael S. Dukakis (D), who announced in January 1989 that he would not seek a fourth term, has seen his popularity plummet along with the state's revenues.

The governor's unpopularity has rubbed off. Lt. Gov. Evelyn Murphy (D) withdrew from the race for governor last week, in part because she could not shed her association with Dukakis.

In the race for lieutenant governor, state Rep. Marjorie Clapprood -- the only woman in a statewide race -- won the Democratic nomination over state Sen. William Golden and state Rep. Nicholas Paleologos. State Sen. Paul Cellucci, who ran the 1988 Bush campaign in Massachusetts, won the GOP nomination over state Rep. Peter Torkildsen.

In the Democratic primary for the third spot on the ticket, Attorney General James Shannon, the only incumbent in a prominent race, lost his bid for reelection to Scott Harshbarger, the Middlesex County prosecutor. "There was a tidal wave coming, and we happened to be standing on the beach when it hit," Shannon said in conceding, referring to the anti-incumbent tide.

Republicans chose Jim Rappaport, a businessman making his political debut, over Dan Daly, another political novice, to challenge first-term Sen. John F. Kerry (D), who had no Democratic opponent.

In the governor's race, Silber gave a voice to the more conservative and disaffected Democrats but wounded himself repeatedly through a series of intemperate remarks, most recently last week when he compared the residents of a predominantly black area of Boston to a "group of drug addicts," then refused to apologize.

Bellotti, a familiar figure after 25 years in politics, presented himself as a more traditional Democrat but one who is not tied to the statehouse establishment.

Republicans, who have not won a statewide office here since 1972, believe they have the best chance in a generation to win the governorship by capitalizing on anxiety over the regional economic recession and rage at a state government that has raised taxes without solving its deficit problem.