U.S. stocks on Tuesday extended gains into a third session after a May rise in consumer prices came in larger than expected, with the data coming a day ahead of the Federal Reserve's monetary-policy decision.
E-Trade Financial rallied as investors saw little reason to believe market rules for the brokerage and others would change as a result of a Senate panel hearing on high-frequency trading. Edwards Lifesciences jumped after garnering regulatory approval for a heart device. Expedia and Netflix both gained as analysts advised buying shares of the online travel site and video-streaming service.
"We're not going to get something different from the Fed tomorrow. They may change the economic outlook, but they are not going to change what they are doing to long-term interest rates," said Art Hogan, chief market strategist at Wunderlich Securities.
"Unlike (Bank of England Governor Mark) Carney and (European Central Bank President Mario) Draghi, our Fed is on autopilot," added Hogan of expectations that the U.S. central bank would reduce its monthly asset purchases by another $10 billion, to $35 billion, and reiterate its intention to hold rates at record lows for a considerable period.
The Labor Department's consumer price index jumped 0.4 percent in May, with the report coming as the Fed starts a two-day monetary-policy session.
An increase in inflation reduces the risk of an extended decline in prices that crimps economic growth, and offers the Fed a reason to maintain their program of scaling back monetary easing.
"The hotter CPI is good news, because we need a modicum of inflation," said Hogan.
"Inflation, it's becoming closer to their target. If that continues to heat up, and goes faster than expected, then the Fed will be stuck," said Nick Raich, chief executive officer at the Earnings Scout.
Still, while Tuesday's report "changes the game a little bit, my guess is it's not enough to have the Fed raise short-term interest rates. We don't think that'll come until 2015," Raich added.
Read MoreWill whiff of inflation prod Fed?
The Commerce Department reported housing starts declined 6.5 percent in May, versus 12.7 percent in April.
"The recovery is there, but it's fragile and gradual. Earnings expectations are going down, but at a lesser rate. that's what stocks are picking up on, and why they are near record highs," said Raich.
After a 48-point fall and 29-point gain, the Dow Jones Industrial Average ended up 27.48 points, or 0.2 percent, at 16,808.49, with Goldman Sachs Group and Home Depot leading blue-chip gains included 15 of its 30 components.
The added 4.21 point, or 0.2 percent, to 1,942.99, with financials and consumer discretionary faring best and utilities and energy hardest hit among its 10 major sectors.
If the S&P 500 takes out 1,955, its recent intra-day high, talk of 2,000 will be in the air again," Elliot Spar, option/market strategist at Stifel, Nicolaus & Co., emailed in afternoon commentary.
Read MoreEnergy stocks may be getting too hot
After also wavering on either side of unchanged, the Nasdaq rose 16.13 points, or 0.4 percent, to 4,337.23.
For every shares declining, less than two gained on the New York Stock Exchange, where 599 million shares traded. Composite volume cleared 2.9 billion.
On Tuesday, Treasury prices fell along with stocks, with the 10-year yield used to figure mortgage rates and other consumer loans rising 5 basis points to 2.652 percent.
The dollar gained against the currencies of major U.S. trading partners and dollar-denominated commodities including oil fell.
On the New York Mercantile Exchange, crude futures for July delivery dropped 54 cents, or 0.5 percent, to $106.36 a barrel and gold futures for August delivery falling $3.30, or 0.3 percent, to $1,272 an ounce.
After Tuesday's close, quarterly results are expected from software company Adobe Systems, while restaurant operator Bob Evans Farms on Tuesday postponed the release of its fourth-quarter earnings by three weeks to address tax and accounting issues.
Ahead of Wednesday's open, shipper FedEx is scheduled to report fourth-quarter results.
"Those companies with May quarter ends are usually a great barometer for how the overall earnings season will shape up," said Raich.
On Monday, Stocks edged higher for a second session as corporate deal making and upbeat manufacturing activity offset increasing violence in Iraq.
The White House on Monday said President Barack Obama was deploying about 275 U.S. troops to guard the American embassy and staff in Baghdad.
—By CNBC's Kate Gibson
Coming Up This Week:
7:00 a.m.: Mortgage applications
8:30 a.m.: Current account Q1
2:00 p.m.: FOMC statement and projections
2:30 p.m. Fed Chair Janet Yellen press briefing
Earnings: Oracle, Blackberry
8:30 a.m.: Initial claims
10:00 a.m.: Philadelphia Fed survey
10:00 a.m.: Leading indicators
Earnings: Darden Restaurants
More From CNBC.com: