A rally in oil prices and a clutch of better-than-expected earnings reports gave a lift to stocks Tuesday, as investors looked past another steep fall in Chinese shares.

The Dow Jones Industrial Average rose 282.01, or 1.8%, to 16167.23. The S&P 500 gained 26.55, or 1.4%, to 1903.63, while the Nasdaq Composite added 49.18, or 1.1%, to 4567.67.

The...