Republican Sen. John W. Warner swept to an overwhelming victory in Virginia yesterday, rolling up the largest margin in a statewide race in recent history. President Reagan also easily carried the the state and Republicans won control of the Fairfax County government for first time since Reconstruction.

Northern Virginia's two Republican congressmen also won reelection and the GOP captured the only open House seat in the state.

The only Northern Virginia Democrat who appeared to survive the GOP onslaught was Arlington County Board member John G. Milliken, who won reelection to a second four-year term with a 3-to-1 showing over his opponent.

All of the state's nine incumbent congressmen -- four Democrats and five Republicans -- won reelection.

In the 7th Congressional District, which includes parts of Prince William and Stafford counties, the GOP held onto the congressional seat vacated by retiring Republican J. Kenneth Robinson of Winchester. Republican D. French Slaughter Jr., a former state legislator from Culpeper, easily defeated Democrat Lewis M. Costello of Winchester in a race both parties had expected to be close. Slaughter received 58 percent of the vote to Costello's 42 percent.

In the Senate race, Warner trounced Democrat Edythe C. Harrison of Norfolk by 70 to 30 percent. The margin surpassed the 57-to-38-percent defeat suffered in 1976 by Democrat Elmo R. Zumwalt at the hands of Sen. Harry F. Byrd Jr., an independent whose father once controlled the state's politics.

"Together, we have tonight made history," Warner said in a victory speech at the Marriott Hotel in Richmond where thousands of people cheered his GOP victory.

According to an NBC exit poll of about 2,200 Virginia voters, Warner and Reagan drew substantial majorities from nearly all segments of Virginia's population, including all age groups, education levels and from both men and women.

Warner, who had won election to the Senate six years ago by the slim margin of 4,700 votes, won about 25 percent of the black vote yesterday, an extremely strong showing for a Republican.

The NBC exit poll showed Reagan with 10 percent of the black vote. Harrison, the first woman to run statewide in Virginia with major party backing, received only 33 percent of the votes cast by women.

Warner and Reagan also made strong showings in every region of the state, carrying every congressional district.

In the Washington suburbs, Republican Rep. Stan Parris fought off a challenge by Democrat state Sen. Richard L. Saslaw of Fairfax for the 8th District seat, which includes Alexandria and parts of Fairfax, Prince William and Stafford counties. Parris, who is actively considering a bid for the 1985 governor's race, told supporters he would soon decide whether to seek the party's nomination for that office. He drew 54 percent of the vote to Saslaw's 45 percent.

In the 10th District, which includes Arlington, Loudoun and northern Fairfax County, two-term Republican Rep. Frank R. Wolf of Fairfax defeated Democrat John P. Flannery of Arlington, a former federal prosecutor, by a landslide margin of 61 to 39 percent.

The landslide for Warner represented a personal triumph for the senator, who in 1978 squeaked to a narrow victory over Democrat Andrew P. Miller. At the time, detractors attributed his victory to the help of actress Elizabeth Taylor, who then was Warner's wife. They have since divorced.

The huge Warner lead, combined with Reagan's strong showing in the state, also was an embarrassment to Democratic Gov. Charles S. Robb. As the leader of the Virginia Democratic Party, Robb has failed to organize strong challenges to Republican senators in 1982 and this year.

State and local Democrats said the Mondale campaign made only a token effort in Virginia and never expected to carry the state. Neither Mondale nor Geraldine A. Ferraro visited Virginia, which has not supported a Democratic presidential candidate since 1964. The only national candidate to campaign there was Vice President Bush.

In the Senate race, Harrison, 50, a former state legislator from Norfolk, waged a fierce, uphill battle. She conceded shortly before 9 p.m., saying she had run a "courageous, strong, issue-oriented campaign."

Robb courted numerous political and business leaders to oppose Warner, but was rejected each time, and Harrison, by default, became the nominee.

Many Democratic Party officeholders complained that Harrison was too liberal for Virginia, and that her outspoken style was too aggressive and abrasive for the state. Harrison replied that the complaints were from the "old boy network" that disliked outsiders, particularly women.