The U.S. economy is delivering some of the best employment and income gains of the past 40 years, boosting workers in a way that recalls the boom years of the 1980s and 1990s.

But while the gains may help Hillary Clinton rebuff Donald Trump’s frequent attacks on the state of the nation and the Obama administration’s record, she would face a series of minefields if she wins the White House. As would Trump, if he pulls off a victory.

Economists say there is a one in five chance of recession next year. The Federal Reserve is on a march toward raising interest rates. And threats continue to flow from abroad, including the United Kingdom’s exit from the European Union and other signs of turbulence in the global economy.

A recession — or even a decline in economic momentum — could rapidly expose the new president to criticism and change the ability of the new administration to accomplish its goals.

“When the economy goes south in the first term, it’s a treacherous situation for a president hoping for reelection,” said Nicole Hemmer, a presidential historian at the University of Virginia.

This is one way that the robust economy at the end of President Obama’s tenure could affect not just the outcome of the campaign but what the next four years look like for whoever occupies the White House.

If wage and employment gains persist for the next four years, many of the concerns about worker stagnation that have dominated the national discussion could ease. If not, it could complicate the next president’s agenda as he or she faces questions about why they are presiding over a weak economy.

The winning candidate appears certain to take office under far less economic strain than Obama did in 2009, in the thick of the Great Recession. In the past two years the economy has gained an unusual level of momentum with sharp improvements for many Americans.

The unemployment rate is low, some out-of-work Americans are rejoining the labor force, and wages rocketed higher in 2015 at their fastest pace since the census started keeping track 50 years ago.

“The recovery has been accelerating in terms of incomes,” said Robert Shapiro, an economist who worked in the Clinton White House and who has donated to Hillary Clinton’s presidential campaign. “What we are seeing is a return to the faster pattern” of the 1980s and 1990s.

A new analysis by Shapiro suggests that the recovery during Obama’s second term has boosted typical workers’ incomes at a rate comparable to the 1990s under Bill Clinton and the 1980s under Ronald Reagan. That finding echoes an analysis of tax data released this summer by Emmanuel Saez, an economist at the University of California at Berkley who found that incomes for the vast majority of Americans grew at a 1990s-style clip in 2015.

Other data show jobs are being created at a faster pace than at any time during George W. Bush’s presidency.

The job-creation gains reflect continued strength in the nation's service sector, including high-skilled technology jobs and lower-skilled jobs in restaurants. The income gains flow from several sources, most notably a tightening labor market, where employers are offering higher pay and more hours to workers to fill job openings. Many economists also cite policy steps taken in recent years, including state and local initiatives to raise the minimum wage.

The current economy is far from roaring on all measures, of course. The most notable disappointment is economic growth, which averaged about 2.2 percent a year from 2013 to 2015 and is doing even worse this year. That’s well below the 1980s and 1990s.

“Normally after a recession ends … you see growth on average about 5 percent” a year, said Beth Ann Bovino, the U.S. chief economist for S&P Global Ratings. “We never saw that.”

Millions of Americans in prime working age, meanwhile, have yet to start looking for work again after leaving the labor force during or after the recession. Many lower-income and middle-class families have not rebuilt the wealth they lost in the recession. And the typical U.S. household still earns less than it did in 1999, a high point.

Trump, the Republican nominee, has accentuated those negatives when campaigning on the economy. In last week’s presidential debate, he called the latest employment report, which showed the economy adding 156,000 jobs in September, “anemic” and said the economy was “dying” amid slow growth.

“Look, our country is stagnant,” he said. “We’ve lost our jobs. We’ve lost our businesses.”

Clinton, the Democratic nominee, has presented a more upbeat view, praising Obama for nurturing the recovery but stressing that workers still need more help from policymakers.

"We are heartened by what we see,” said Jacob Leibenluft, a senior adviser to Clinton. “It provides a good foundation to build off. But we see the remaining challenge: Many families feel anxieties and squeezes that are not imagined. They are real.”

Reagan’s approval ratings hit their lowest point in 1983, just after the trough of a recession that plagued his first term. But they rebounded when the economy rocketed upward later that year, and he won reelection in 1984 in a landslide.

His successor, George H.W. Bush, was less fortunate. He had a 90 percent approval rating in early 1991, as measured by Gallup, on the strength of the United States' success in the Persian Gulf War. But his popular support crumbled as the economy struggled to rebound from a recession that ended in the spring of that year. Median household incomes fell in 1991 and 1992, and Bill Clinton ousted Bush after one term.

Today’s unemployment rate has fallen under 5 percent — a full point below the 6 percent rate Obama’s 2012 opponent, Mitt Romney, promised to deliver by 2016.

Shapiro’s analysis breaks down the overall trends into groups by age: young workers; workers in their 30s, their prime earning years; and workers in their late 40s.

The income for median households headed by someone 35 to 39 rose by 2.8 percent per year, on average, under Reagan and 2.5 percent, on average, under Clinton. In Obama’s first term, it fell to 1.4 percent. But since 2013, it has more than doubled, to 2.9 percent.

The story is near-identical for people in their mid-20s. Households headed by someone in their late 40s have had stronger income gains during Obama’s second term than under Reagan or Clinton. Similar patterns largely hold across gender, racial/ethnic and education lines.

Those numbers may surprise many Americans, because they defy the narrative of much of Obama’s time in office. Median incomes fell or stagnated for years after the recession ended in 2009. Only in 2013, when the unemployment rate began to fall rapidly, did income growth pick up. The first version of Shapiro’s analysis, which stopped with 2013 data, showed a bleak picture for the Obama years.

Obama administration officials have celebrated the upturn, saying they now allow the next president to tackle longer-term issues.

“Obama’s original motivation was the structural economic challenges we’d been facing, in terms of weak income growth for families and increasing inequality,” Jason Furman, the chairman of the White House Council of Economic Advisers, said in an interview. But, he said, “the biggest threat to families when his presidency began was an economy that was cratering, losing 800,000 jobs per month.”

Now, Furman added, “the next president will be in a place where he or she is inheriting an economy in much better cyclical shape.”

Trump has promised rapid growth via tax cuts, deregulation, increased energy exploration and renegotiated trade agreements. Clinton has focused on several incentives to allow parents, particularly mothers, to work more, and to push businesses to invest more efficiently.

Both candidates have pledged to spend hundreds of billions of dollars upgrading infrastructure.

One big factor outside the next president’s immediate control will be the Federal Reserve. After years of holding interest rates near zero to stimulate growth, the nation's central bankers increased rates last December and now seem inclined to do so again this December, and again next year.

“The real unanswered question that the new administration is going to find out the answer to next year,” said Ian Shepherdson, chief economist for Pantheon Macroeconomics, “is: How does the economy respond when the Fed starts to raise rates?”

Some Fed officials, Shepherdson notes, are on record as saying that a rate increase could actually boost confidence and growth in the economy. Markets, he notes, expect the opposite: that a rate increase will slow the economy, gradually or immediately.