WASHINGTON — The trade deficit soared to the highest level in more than a year, as an improvement in exports was swamped by record-high levels of imported crude oil.

The deficit with China also rose sharply.

The gap between what the nation imports and what it sells abroad rose by 7.8 percent in April to $60.9 billion, the Commerce Department reported Tuesday. It was the largest imbalance since March 2007.

The higher deficit was driven by a $4.3 billion increase in crude oil imports, which jumped to a record $29.3 billion in April, as the average per-barrel price rose to an all-time high of $96.81.

If the price of crude had instead been at $60 per barrel, about where it was a year ago, the trade deficit would have been $11 billion lower in April. Analysts cautioned the deficit will widen further in coming months, given that oil is now trading above $130 per barrel.

U.S. export sales totaled $155.5 billion in April, up 3.3 percent to an all-time high, reflecting big gains in sales of commercial aircraft, farm machinery, medical equipment and computers. But this increase was swamped by a 4.5 percent rise in imports, which also set a record at $216.4 billion. In addition to oil, there were huge gains in imports of autos and consumer goods.

On Wall Street, stocks finished a lackluster day, as a drop in oil prices failed to keep investors from worrying about the adverse effects of high energy costs. The Dow Jones industrial average edged up 9.44 points to close at 12,289.76.

The trade deficit through the first four months of this year is running at an annual rate of $707.5 billion, up slightly from last year's deficit of $700.3 billion, which was a 7 percent drop from 2006. The improvement last year came after the trade imbalance set records for five consecutive years.

Many economists are looking for the deficit to shrink again this year, reflecting a significant economic slowdown in the United States that is cutting into demand for imports and the weak dollar, which has helped to boost U.S. exports.

Exports are the standout performer at the moment in an economy beset by a prolonged slump in housing, a severe credit crunch and rising unemployment.

Nigel Gault, chief U.S. economist for Global Insight, predicted foreign trade would add about 1 percentage point to economic growth in the current quarter, helping to keep overall growth slightly above zero and avoiding a negative reading that could be a sign of recession.

The politically sensitive deficit with China shot up by 25.9 percent in April to $20.2 billion, the highest level in three months, reflecting higher imports of a wide range of Chinese products, from toys and games to televisions, electrical appliances and clothing.

Democrats hope to attack Republicans in the presidential and congressional races this fall for supporting trade policies that they claim have contributed to the loss of more than 3 million manufacturing jobs since 2001 by failing to prevent U.S. companies from shipping production overseas to low-wage countries such as China.

In a statement, Sen. Barack Obama, the presumptive Democratic presidential nominee, said the jump in the trade deficit in April was "yet another sign of the failed economic policies of the Bush administration." Obama pledged to work for a trade policy that "serves the interests not just of multinational corporations but of America's hardworking families."

The administration, which is trying to win congressional approval for pending free trade agreements with Colombia, Panama and South Korea, said the big jump in exports showed its policies are working.

"We must continue to promote open economic policies that generate record export growth and enhance American competitiveness," Commerce Secretary Carlos Gutierrez said in a statement.

Sens. Sherrod Brown, D-Ohio, and Russ Feingold, D-Wis., along with other Democrats in the Senate and House introduced legislation last week that would require reviews of existing trade agreements and renegotiation of deals found lacking in protections for American workers against competition from low-wage countries.

"We've got to re-examine our trade agreements," said Teamsters General President James Hoffa, whose union supports the proposal. "It's time to encourage corporations to invest in jobs within our borders rather than overseas."

The Bush administration, which has stood by as the dollar has fallen to historic lows against the euro and other currencies, has switched its rhetoric in recent days, with President Bush and Treasury Secretary Henry Paulson putting new emphasis on the need for a strong dollar, following comments last week by Federal Reserve Chairman Ben Bernanke that the weak dollar, which has contributed to the surge in oil prices, was fanning unwanted inflation in this country.