U.S. stocks closed higher on Wednesday as oil hit highs for the year and investors continued to digest financial earnings and economic reports.
"The big highlight for today is energy," said Paul Nolte, portfolio manager at Kingsview Asset Management. "On the whole, the earnings numbers are a little better than expectations and the economic data is keeping the Fed on the sidelines."
Commodities settled at key levels, with crude oil ending up $3.10, or 5.82 percent, at $56.39 a barrel, its highest close of the year. Gold futures settled up $8.70 at $1,201.30 an ounce.
If oil can post consecutive settlements above $56 a barrel, the commodity would be on track to break a second resistance level of $65 a barrel, BTIG's chief technical strategist Katie Stockton said. "Intermediate-term momentum has been improving for WTI crude oil since February."
The energy sector rose more than 2 percent to lead the S&P 500 for a second day as WTI crude oil hit its highest level in 2015. ( Tweet This ) Oil extended gains following the U.S. Energy Information Administration reported a less-than-expected increase of 1.3 million barrels in weekly inventories.
"The EIA numbers are very bullish," Phil Flynn, energy market analyst at the Price Futures Group, said in an email. "It indicates stronger demand and the smaller crude build may be a sign that U.S. production is peaking! This comes after the (International Energy Agency) report that shows a notable increase in demand!"
Oil drilling and exploration giant Transocean (RIG) closed up 10.14 percent to lead advancing energy stocks in the S&P 500. Marathon Petroleum (MPC) and Valero Energy (VLO) were the only decliners in the sector.
"I think you could assume that oil has made a bottom. If that's the case then the whole industry group should stabilize and that's a boost to the entire market," said Bruce Bittles, chief investment strategist at RW Baird.
Stocks extended gains slightly following the Federal Reserve's Beige Book noted improvements in residential real estate but reported overall moderate growth.
"Basically it alludes to a mixed picture this quarter," said Peter Cardillo, chief market economist at Rockwell Global Capital. "I think some of the indications here are going to be 'hands off' on a rate hike in June."
Investors also cheered mostly positive corporate reports as earnings season began.
The Nasdaq outperformed the major averages to close above the psychologically key 5,000 level. The Russell 2000 closed at a new high.
The Dow Jones industrial average briefly gained more than 100 points, boosted by more than 4 percent gain in Intel (INTC). After the bell on Tuesday, the blue chip reported earnings in line with estimates on revenue that missed, but said it expects to benefit from gains in its personal computer chips and its data center business.
"The tone so far has been surprisingly positive to relatively low expectations," said Jeremy Zirin, head CIO investment strategist at UBS Wealth Management Americas. Despite initial concerns about the stronger dollar, Zirin said "the market seems to be paying attention to the company fundamentals rather than the currency headlines."
Before the open on Tuesday, Bank of America (BAC) posted a first-quarter profit, swinging from a surprise loss a year earlier when it took a charge of $6 billion for litigation expenses. However, the bank saw a slight decline in its investment banking and equity and debt market businesses while JPMorgan Chase (JPM) reported investment banking fees and core trading revenues were both up about 20 percent year over year.
"Those financials that have trading desks may have had a better quarter than those that don't," said Randy Frederick, managing director of trading and derivatives at Charles Schwab. Volatility for about two-thirds of the quarter has increased trade volume while the low interest rates continue to weigh on institutions with a greater focus on lending.
Among the several other financial firms posting results before the bell, US Bancorp reported earnings in-line with estimates on revenue that missed. PNC Financial beat on earnings but missed on revenue.
Charles Schwab (SCHW) said its first-quarter net income fell 7 percent to $302 million on slower client trading activity and higher spending focused in part on the discount brokerage's new robo-adviser offering.
Delta Air Lines (DAL) led gains in the Dow transports after reporting an adjusted 45 cents per share for its latest quarter, one cent above estimates, with revenue essentially in line. The airline said this represented the best March quarter in its history, although it added that the strong dollar was presenting headwinds for its international revenue.
So far, the sum of the earnings reports "doesn't raise an alarm that the positive earnings cycle is over," said Bill Stone, chief investment strategist at PNC Asset Management. He noted that as of Tuesday, the nearly 40 companies that reported had almost 14 percent growth.
More major financial earnings come out on Thursday, with BlackRock (BLK), Goldman Sachs (GS) and Citigroup (NYSE:C) before the bell andAmerican Express (AXP) after the close. The first of the energy giants, Schlumberger (SLB), posts results after Thursday's close.
On the data front, industrial production for March showed a greater-than-expected decline of 0.6 percent, following a slight gain in February. Capacity utilization also came in slightly below the previous month.
"Every data point is coming in and saying the same thing-weak comparables," said Mark Luschini, chief investment strategist at Janney Montgomery Scott, noting that the Federal Reserve will carefully watch April data for signs that the weak first quarter data was weather-related.
"They seem to be willing to look through this data and do what they are inclined to do and that is raise rates in the second half of this year," Luschini said.
Art Hogan, chief market strategist at Wunderlich Securities, said that earnings beats were outweighing negative economic data.
"That's the environment we're in right now. The marco has shifted to the micro," he said. "This is good. At least right now this is the purest time (for stocks)."
Mortgage applications decreased 2.3 percent from the prior week as interest rates ticked up slightly, according to the Mortgage Bankers Association.
Meanwhile, the Empire Manufacturing survey showed growth in New York State unexpectedly contracted in April, weakening for a third straight month as the pace of new orders fell to a multi-year low, a New York Federal Reserve survey showed on Wednesday. The index showed a decline of 1.19 in April versus March's 6.90 read.
The National Association of Home Builders housing market index showed a sharp increase to 56 in April.
Treasury data on international capital flows is due at 4 p.m.
The U.S. economy is expected to see a boom that will send the unemployment rate into the 4 percent range , adding to evidence that the Federal Reserve should start raising interest rates, St. Louis Fed President James Bullard said on Wednesday.
The Dow Jones Industrial Average (Dow Jones Global Indexes: .DJI) closed up 75.91 points, or 0.42 percent, at 18,112.61, with Intel (INTC) leading advancers and UnitedHealth (UNH) the greatest laggard.
The S&P 500 (^GSPC) closed up 10.79 points, or 0.51 percent, at 2,106.63, with energy leading all sectors except consumer staples higher.
The Nasdaq (^IXIC) closed up 33.73 points, or 0.68 percent, at 5,011.02.
The CBOE Volatility Index (VIX) (^VIX), widely considered the best gauge of fear in the market, traded just below 13.
About two stocks advanced for every decliner on the New York Stock Exchange, with an exchange volume of 877 million and a composite volume of nearly 4 billion in the close.
The U.S. 10-year Treasury yield held near 1.89 percent. The U.S. dollar fell on the softer domestic data, with the euro edging higher towards $1.07.
Greece remained in focus, with S&P downgrarding its rating to "CCC+" from "B-" with a negative outlook.
Germany's Finance Minister Wolfgang Schauble said at the Council on Foreign Relations in New York that the new Greek government has damaged an improving economic trend in the country but he cannot see any contagion in the market from Greece troubles and that the markets have priced in all possibilities . The problem with Greece is not its loans but its lack of competitiveness, he said.
In other regional news, the European Union has formally filed formal charges against Google (GOOGL) over its comparison shopping service, and said it would open a formal investigation of Google's Android operating system and whether the company uses its market power to hinder rival systems.
Asian equities ended mixed after China reported gross domestic product growth at its slowest pace since the global financial crisis.
"The Federal Reserve is more likely to focus on domestic (news) rather than factoring in European numbers or China's GDP," said Tim Dreiling, senior portfolio manager at U.S. Bank Wealth Management.
-CNBC's Peter Schacknow and Reuters contributed to this report.
On tap this week:
Earnings: Netflix, SanDisk, Universal Forest Products
4:00 p.m.: TIC data
Earnings: BlackRock, Citigroup, Goldman Sachs, Blackstone, American Express, Schlumberger, Celanese, Crown Holdings, UnitedHealth, Taiwan Semiconductor, Philip Morris, First Republic Bank, KeyCorp, Mattel, Sherwin-Williams, Sonoco Products, PPG Industries, WW Grainger
8:30 a.m.: Initial claims
8:30 a.m.: Housing starts
10:00 a.m.: Philadelphia Fed survey
1:00 p.m.: Atlanta Fed President Dennis Lockhart
1:10 p.m.: Cleveland Fed President Loretta Mester
1:30 p.m.: Boston Fed President Eric Rosengren
3:00 p.m.: Fed Vice Chairman Fischer on inflation at IMF spring meeting
Earnings: GE, Honeywell, Synchrony Financial, Comerica
8:30 a.m.: CPI
10:00 a.m.: Consumer sentiment
More From CNBC.com:
- 10 questions for Harry Reid
- Earnings bellwethers aren't what they used to be
- The fight for $15: McDonald's franchise workers join protest
More From CNBC