With $1.9 billion less exports and $1.8 billion less imports in July from June, the deficit came to $42 billion following a revised figure for June of $41.9 billion.
Investors anticipate a Federal Reserve announcement Thursday on a third round of quantitative easing.
Paradoxically, weak economic data until Thursday can be viewed as a reason for the Fed to act on the stimulus program, while positive data would decrease the Fed's chance of approving what is called QE3.
By close of trading on Wall Street Tuesday, the Dow Jones industrial average gained 69.0 points, or 0.52 percent, to 13,323.36. The tech-heavy Nasdaq Composite index added 0.51 points, or 0.02 percent, to 3,104.53. The Standard and Poor's 500 added 4.48 points, or 0.31 percent, to 1,433.56.
On the New York Stock Exchange, 2,041 stocks advanced and 980 declined on a volume of 3.3 billion shares traded.
The benchmark 10-year treasury fell 15/32 to yield 1.708 percent.
The euro rose to $1.2852 from Monday's $1.2759. Against the yen, the dollar fell to 77.78 yen from 78.28 yen.
In Tokyo, the Nikkei 255 index shed 0.7 percent, 61.99 points, to 8,807.38.
In London, the FTSE 100 index dropped 0.02 percent, 1.01 points, to 5,792.19.
Verizon backing off plan to slow unlimited data
Pepsi launches stevia-sweetened soda