Stocks closed marginally lower Wednesday after a session of seesaw trading and profit-taking following a two-day rally.

The Dow Jones industrial average lost 1.20, or 0.01 percent, to 11,102.51after rising a total of 230 points the first two days this week.

Broader stock indicators also fell. The Standard & Poor's 500 index lost 0.48, or 0.04 percent, to 1,268.40, while the Nasdaq composite index lost 3.44, or 0.17 percent, to 2,070.46.

Click here to visit FOXBusiness.com's Investing Center.

Stocks opened lower, swung to a gain after the Federal Reserve's Beige Book of regional economic conditions said inflation was in check and then dropped as the session neared its close.

Consumer discretionary and industrial stocks finished lower as investors sold off Amazon.com (AMZN) Inc., Boeing Co. (BA) and UPS Inc. (UPS) on disappointing earnings news.

Energy stocks gained as a spike in oil prices helped the sector. A barrel of light crude settled at $74.94, up 19 cents, on the New York Mercantile Exchange. Oil had advanced as much as 90 cents a barrel earlier in the session. Health care and utility stocks also rose as investors headed into the traditionally defensive sectors, which tend to do well in a choppy economy.

In months of erratic trading, investors have frequently met one day's advances with a selloff the next session to lock in profits. With volatility on the rise, swings of 100 points are now "the norm, not the exception," said Arthur Hogan, chief market analyst at Jefferies & Co.

Advancing issues led decliners by roughly 9 to 7 on the New York Stock Exchange.

Bonds rallied. The yield on the 10-year Treasury note fell to 5.03 percent, down from 5.07 percent Thursday. The U.S. dollar was mixed against other major currencies. Gold prices rose.

While earnings season is off to a solid start, the outlook is uncertain.

"From the companies that have reported, I would say that it's clear that earnings growth is going to slow in the second half of the year. The question is to what degree," said Brian Bush, director of equity research, Stephens Inc.

Investors are slightly anxious over earnings, but much more nervous about the Aug. 8 meeting of the Fed, which could bring the 18th straight increase in the fed funds rate, the nation's benchmark interest rate. The markets are hoping that the Fed will then put its rate hike program on hold.

In company news, General Motors Corp. (GM) rose $1.34, or 4.4 percent, to $32 after it said it lost $3.2 billion in the second quarter as it absorbed heavy charges for its massive restructuring program. But the world's largest automaker reported an adjusted profit without the charges that beat Wall Street estimates and its sales surged 12 percent.

Transportation stocks plummeted as railway and freight shipping company Norfolk Southern Corp. (NSC) fell $3.85, or 8.5 percent, to $41.40 after its second-quarter profit dropped 11.6 percent. Higher fuel costs offset an increase in revenue from heavier shipping volumes and fuel surcharges. Competitor CSX Corp. also dropped sharply, falling $3.72, or 5.9 percent, to $59.09.

Shares of shipping company United Parcel Service fell $3.97 to $67.83, dropping for the second straight session after the company's second-quarter earnings missed analysts' estimates by a wide margin.

Boeing Co., the world's largest aerospace company, fell $3.85, or 4.6 percent, to $79.90 after it reported a $160 million loss for the second quarter on more than $1 billion in charges, including the steep cost to settle a Justice Department investigation into its defense contracting.

Amazon.com Inc. fell $7.33, or 22 percent, to $26.26 after its second-quarter earnings plunged nearly 58 percent as the online retailer focused on giving customers cheap or free shipping deals and investing in new technologies. It also projected lower operating income for the year than previously forecast.

The Russell 2000 index of smaller companies fell 2.99, or 0.43 percent, to 694.45.

NYSE volume was 1.82 billion shares, up from 1.75 billion at the same time Tuesday

Overseas, Japan's Nikkei stock average fell 0.81 percent. Britain's FTSE 100 rose 0.44 percent, Germany's DAX index rose 0.31 percent, and France's CAC-40 rose 0.20 percent.

Click here to visit FOXBusiness.com's Investing Center.