WASHINGTON – In the early hours of election night on Tuesday, a consensus began to take hold that the vaunted Democratic blue wave that had been talked about all year was failing to materialize. Now, with a handful of races still to be called, it's clear that an anti-President Donald Trump force hit the country with considerable, if uneven, strength.

Democrats appear poised to pick up 35 to 40 seats in the House once the last races are tallied, according to strategists in both parties. That would represent the biggest Democratic gain in the House since the post-Watergate election of 1974, when the party picked up 49 seats three months after Richard Nixon resigned the presidency.

Republicans will gain seats in the Senate, but with races in Florida and Arizona still to be called, their pre-election majority of 51 seats will end up as low as 52 or as high as 54. Meanwhile, Democrats gained at least seven governorships, recouping in part losses sustained in 2010 and 2014, and picked up hundreds of state legislative seats, where they had suffered a virtual wipeout in the previous two midterm elections.

The Democrats' gains this week are still far short of what Republicans accomplished in their historic victories of 1994 and 2010. But they would eclipse the number of seats Democrats gained in 2006, the last time the party recaptured control of the House, as well as the 26-seat gain in 1982, when the national unemployment rate was at 10 percent. This year, the election took place with the unemployment rate at just 3.7 percent.

Day by day, the outlook for Democrats in the House has improved. At the offices of the Democratic Congressional Campaign Committee, already-high spirits rose all week as more races fell into the party's column. One joke that has been making the rounds there goes like this: "This is actually turning out to be more of a Hanukkah than a Christmas election," meaning day after day of gifts, rather than just one.

This was always an election that would test the strength of the economy, which favored the president's party, versus the president's low approval ratings, which along with the record of past midterm elections, pointed to Democratic gains. In the end, history and presidential approval combined to give Democrats control of the House by what appears to be a comfortable margin.

The Democratic wave hit hardest in suburban districts, many of them traditional Republican territory, where college-educated voters — particularly women — dissatisfied with the president backed Democratic challengers. Ronald Brownstein of the Atlantic and CNN, who has closely tracked these changes over many elections, noted in a postelection article that, before the election, two-thirds of Republicans represented congressional districts where the percentage of the population with college degrees was below the national average. After the election, he estimated, more than three-quarters of GOP House members now will represent such districts.

Democrats flipped about two-thirds of the competitive districts won by both Hillary Clinton in 2016 and Barack Obama in 2012 or by Clinton in 2016 and Mitt Romney in 2012. They also picked up one-third of districts won by Trump in 2016 and Obama in 2012. In districts where both Trump and Romney had won in the previous two elections, Democrats gained about a quarter of the competitive seats.

Also striking in House races was the number of narrow victory margins — on both sides. About 20 Democrats won or are leading in races where the margin is fewer than 5 percentage points, while about two dozen Republicans won or are leading in races with similarly small margins.

That indicates that the outcome in 2018 could have been substantially better for Democrats or significantly worse, had the political winds been blowing differently. It also foreshadows another fiercely contested election for the House in 2020.

The final outcome in the Senate races this year will also have a bearing on 2020. The difference between a majority of 54 seats or 52 seats would have a sizable impact on the odds of Democrats being able to win control two years from now.

Republicans expect to defend 22 seats up for election, compared with only 12 seats held by Democrats. These include the Colorado seat of Sen. Cory Gardner, the Maine seat of Sen. Susan Collins and the Arizona seat now held by Sen. Jon Kyl. Senate Republicans Joni Ernst of Iowa and Thom Tillis of North Carolina are likely to face competitive races. Democrat Doug Jones of Alabama, who won a special election last year, also will face a serious challenge to hold his seat.

Beyond the tally of victories and defeats, the 2018 election was notable for the ways in which it deepened many of the divisions and shifts in allegiance that are changing the political landscape across the country. That carries implications for politics in 2020 and beyond.

Democratic strategists have been cheered by exit polls that show the underlying national demographic trends that drove their gains, particularly in the border states of California, Arizona, New Mexico and Texas.

Voters under the age of 29 voted for Democrats over Republicans by 67 percent to 32 percent, a margin that beats the previous record in the 2008 presidential election. Latino voters matched their national 11 percent vote share from the higher-turnout 2016 election, with Democrats winning 69 percent of the Latino vote nationwide, slightly more than the 66 percent share when Trump was elected. Asian voters, who make up about 3 percent of the voting population, sided heavily with Democrats by a margin of 77 percent to 23 percent.

Republican pollster Whit Ayres said: "To me, the big story is that the 2018 midterm election reinforced and accelerated the patterns we saw in 2016. You had smaller, overwhelmingly white, rural counties become more deeply entrenched in the Republican Party, and suburban counties, particularly those with high proportions of well-educated voters, going exactly the opposite direction."

In Colorado, Democrats won every statewide race, picked up a House seat, took control of the state Senate, and swept most down-ballot races as well. "We are not Ohio, Michigan or the Midwest. The college-educated suburban voter — they don't like Trump because of his behavior," said Dick Wadhams, the former chairman of the state GOP.

In Nevada, Democrats picked up a Senate seat and the governorship and held on to two competitive House districts, in a sign of a continued shift left in what has been a closely contested state in most recent elections.

But other results offer some encouragement to Republicans.

Ohio appears to be moving steadily away from the Democrats, largely because of cultural issues. Since 1994, Republicans have won nearly nine of every 10 statewide contests. The GOP's victory in the open gubernatorial race on Tuesday was the latest blow for the Democrats, though Democratic Sen. Sherrod Brown held his seat.

Democrats also failed to pick up the governorship in Iowa, though they gained two House seats. They struggled to make inroads in House races in Republican strongholds such as Kentucky, North Carolina and Nebraska.

Florida remains a top concern heading into the 2020 elections, when the state will probably play a crucial role in any path for Trump to win a second term. Contrary to the Latino vote elsewhere in the country, the Cuban, Puerto Rican and Central American populations in the Sunshine State split more evenly, as Republican Gov. Rick Scott mounted an aggressive outreach effort in his Senate race.

Of the 15 percent of voters in the state who were Latino, Scott was able to win 45 percent, according to exit polls, including a slight majority of Latino men. The Republican gubernatorial candidate, former congressman Ron DeSantis, was able to win 44 percent of Latino voters.