Two local Republican state senators, running in newly drawn districts where Democrats had edges in enrollment, won their races Tuesday night.

Sen. George D. Maziarz, R-Newfane, captured his 10th term in the Senate, turning back the challenge of Amy Hope Witryol in the 62nd District.

State Sen. Michael H. Ranzenhofer, R-Amherst, had a closer race in winning his third term over Newstead Councilman Justin H. Rooney.

In the 61st District, which includes Amherst, Clarence, Newstead, all of Genesee County and two towns in Monroe County, Ranzenhofer led Rooney 66,134 to 45,946 with 95 percent of the vote counted in the Erie County portion of the district, and complete results from Genesee and Monroe counties. That was a 59 percent to 41 percent margin.

Ranzenhofer carried Genesee County, 14,983 to 6,185 in complete but unofficial returns. That more than canceled out Rooney’s success in the Monroe County towns of Riga and Chili, which went for Rooney by a margin of 15,784 to 9,691.

In the 62nd District, Witryol carried almost 38 percent of the vote, better than she did when she challenged Maziarz in 2010, when the district did not include the Democrat-heavy City of Niagara Falls.

Results with 95 percent of the Niagara County vote counted, plus complete but unofficial returns from Orleans and Monroe counties, showed Maziarz with 62 percent of the vote. He had 63,061 votes to 38,749 for Witryol.

Maziarz defeated Witryol two years ago, 68 percent to 32 percent. Maziarz has been a senator since 1995 and until Tuesday, 68 percent was his worst showing in a two-way race. Niagara County results were late to report because of a serious computer problem at the Board of Elections, but Maziarz had a 60 to 40 percent margin over Witryol in his home county. He had a 17,000-vote lead, with 95 percent of the vote counted.

Maziarz said it appeared there had been a heavy turnout in Niagara Falls, where he said his internal polling had given him a 55 percent to 45 percent lead. However, Republican poll watchers gave Maziarz an edge of more than 2-to-1 in the Lockport area, and Maziarz was sure that the results from his native North Tonawanda would more than cancel out any edge Witryol might have had in the Falls.

“I’m very comfortable with it. In this business, 55 percent is a landslide. Anything over 55 percent is a gift,” Maziarz said. Maziarz also won the other counties in the district, in solidly Republican territory.

Orleans County showed a margin of 9,011 to 4,058 for Maziarz. In the Monroe County towns of Ogden and Sweden, Maziarz won, 7,288 to 5,153 in complete but unofficial returns. Maziarz attributed his success to “the work we do year-round. The constituent service we offer is second to none.”

He said he was able to promote some of the achievements he’s worked on with Democratic Gov. Andrew M. Cuomo, including the Recharge New York hydropower plan and the 2 percent property tax cap.

But the Democratic enrollment advantage did not enable Witryol to overcome Maziarz’s advantages in incumbency and campaign funding.

Through Oct. 25, Maziarz raised $406,000 this year against Witryol’s $32,000. Maziarz spent $324,000 against Witryol’s $28,000.

At that, Witryol was well-heeled compared with Rooney, whose last financial report showed he had raised and spent less than $1,000. Ranzenhofer, meanwhile, raised $300,000 this year and spent $166,000.

Through Oct. 25, Maziarz raised $406,000 against Witryol’s $32,000.

Three other local incumbents were re-elected without opposition: Republicans Catharine M. Young of Olean in the 57th District and Patrick M. Gallivan of Elma in the 59th District, and Democrat Timothy M. Kennedy of Buffalo in the 63rd District.