NEW YORK (CNNMoney.com) -- The gap between imports and exports narrowed slightly in July despite a jump in imports from China, an increase that made that nation the No. 1 source of U.S. imports.

The gap was $59.2 billion in July, down from the revised $59.4 billion in June, according to the Commerce Department. Economists surveyed by Briefing.com had forecast a $59 billion trade deficit.

The U.S. trade gap narrowed despite a jump in Chinese imports in July.

The trade gap with China rose 12.5 percent from June levels and 21.6 percent from the year-earlier period to $23.8 billion. Chinese imports moved ahead of those from Canada with this report.

Chinese goods shipped here had only narrowly trailed Canadian imports in the June report, and in July they were well ahead, $28.6 billion compared to $24.5 billion.

The Canadian imports have rarely become a major trade issue here because of far greater balance in goods across the border. In fact, Canada is the largest market for U.S. exports, buying $18.8 billion in U.S.-made goods in the July report, for a gap of only $5.7 billion.

China, despite its size and rapid growth, bought only $4.8 billion of U.S. goods in July.

The only better market for U.S. goods are the nations of the European Union as a group, which bought $18.9 billion in U.S. exports while selling $31.9 billion in exports to the United States as a group. But no European country by itself was anywhere near the level of Chinese goods shipped here.

The trade gap of goods to and from China now accounts for 40.2 percent of the nation's overall trade gap, up from 35.6 percent in June and 29 percent a year ago.

The trade gap also is drawing greater attention due to concerns about the safety of Chinese imports. Toymaker Mattel (Charts, Fortune 500) has had three major recalls of Chinese-made toys since Aug. 1, and Congress is holding hearings Wednesday and next week on the issue.

In addition, Walt Disney Co. (Charts, Fortune 500) has announced a testing program for toys it licenses coming in from China, as has retailer Toys R Us.

There have also been recalls of in recent months of Chinese-produced toothpaste, seafood, animal feed, tires and car fuses, all due to concerns about the safety of the products.

Higher oil prices also put pressure on the U.S. trade gap, as the average price of a barrel of imported oil in the month was up 7.6 percent to $65.56, the highest average price since August 2006.

But a drop in the volume of oil exports meant that the part of the trade gap attributed to petroleum increased only 2.3 percent from June. That was more than balanced off by a 3 percent drop in the gap attributed to non-petroleum trade.

In fact the part of the trade gap attributed to petroleum - $24 billion - is only slightly ahead of the part of the gap attributed to trade of goods with China.