Updated from 4:15 p.m. EDTStocks in the U.S. closed to the upside Wednesday, but selling pressure in the final hour left the major averages well below their best levels of the day. For most of the session, the indices rallied amid cooler-than-expected inflationary data and results at Freddie Mac ( FRE) that weren't nearly as bad as analysts had predicted. However, by the close, the Dow Jones Industrial Average had given up more than half its gains and was ahead by 66.2 points, or 0.52%, to 12,898.38. The S&P 500 added 5.62 points, or 0.4%, to 1408.66. The Nasdaq Composite, which outperformed for much of the day, in the end barely held onto positive territory as big tech names Google ( GOOG), Apple ( AAPL) and Amazon.com ( AMZN) saw weakness in the last hour of trading. The index edged up 1.58 points, or 0.06%, to 2497. The late fade notwithstanding, Steven Sheldon, CFA and principal with SMS Capital Management, called the day's action a "relief rally" in response to the encouraging consumer price numbers, since trepidation about inflation has been fairly prevalent among investors. The Labor Department said that, despite a 0.9% jump in food costs -- the biggest advance in nearly two decades -- April consumer prices rose only 0.2% from the prior month. Economists had been looking for a 0.3% uptick. The core consumer price index, which excludes food and energy, rose 0.1%, or half of the expected increase. Energy prices, the government said, were unchanged from March. Year over year, core consumer inflation was up 2.3%, a bit lower than anticipated, while the overall CPI climbed 3.9% from a year ago.