U.S. stocks closed about 1 percent higher Monday, with energy stocks leading as oil prices hit fresh highs for the year so far.
"I think Apple and oil, they are really overshadowing everything else," said JJ Kinahan, chief strategist at TD Ameritrade.
Apple (AAPL) closed 3.7 percent higher, off session highs but still posting its best day since March 1. ( Tweet This ) The stock is 29.4 percent below its 52-week intraday high touched last July and fell last week below $90 a share to touch a new 52-week intraday low.
Apple contributed the most to gains in the Dow Jones industrial average, which closed about 175 points higher after earlier adding more than 200 points. Home Depot (HD) and Boeing (BA) had the next greatest positive impact on the Dow.
The Nasdaq composite outperformed, closing up 1.2 percent with the iShares Nasdaq Biotechnology ETF (IBB) (IBB) rising 3.06 percent for its best day since April 6. The VanEck Vectors Semiconductor ETF (SMH) (NYSE Arca: SMH) closed up 2 percent for its best day since April 13.
Pfizer (PFE) is buying Anacor Pharmaceuticals (ANAC) in a $5.2 billion deal to add an eczema gel to its portfolio, just a month after plans to acquire Allergan (AGN) fell apart. Shares of Anacor surged 57 percent while Pfizer gained nearly 0.6 percent and Allergan closed up 0.75 percent.
"It's always good to start the week off with a big M&A transaction, particularly in health care," said Marc Chaikin, CEO of Chaikin Analytics.
"This is all very short-term stuff. This is what happens in a trading range," he said, also noting some sentiment in the market of "bad news is good news" in delaying the next Fed rate hike.
"There's enough good news to keep the market going but not enough good news to propel it to new highs," said Bruce McCain, chief investment strategist at Key Private Bank.
Energy closed up nearly 1.6 percent to lead all S&P 500 sectors higher. Tech, materials and healthcare each gained more than 1.3 percent.
U.S. crude oil futures settled up $1.51 at $47.72 a barrel. Brent settled up 2.38 percent at $48.97, after earlier topping $49 a barrel. Both settled at their highest since Nov. 3.
The gains came on growing Nigerian oil output disruptions and after long-time bear Goldman Sachs said the market had flipped to a deficit, ending almost two years of oversupply .
The Dow transports closed about 0.7 percent higher, off session highs.
"I think what oil will do today is support a steady to higher trading day," said Peter Cardillo, chief market economist at First Standard Financial.
"I think oil helps but it plays like a balancing act between the Feds and macro news," he said, noting investors were watching recent data for indications on the timing of the next Fed rate hike.
Treasury yields were higher, with the 2-year yield (U.S.:US2Y) near 0.78 percent and the 10-year yield (U.S.:US10Y) around 1.75 percent.
"Everyone's searching for the magic bullet at the moment, the (next) great trade and there's a lot of reshuffling of the deck," Kinahan said.
The U.S. dollar index was flat, with the euro around $1.132 and the yen near 109 yen against the greenback.
As of the close Monday, the Dow and S&P were about 3.5 percent or less below their 52-week intraday highs touched last May, while the Nasdaq composite was about 8.7 percent below its 52-week intraday high hit last July.
"We continue to grow positively. Even if it's slow, at these low interest rate levels we should continue to expand multiples after a period of consolidation," said Ben Pace, CIO at HPM Partners.
Read More It's time for the economy to step up
European stocks ended narrowly mixed. German markets were closed for a holiday.
China's investment, factory output and retail sales all grew more slowly than expected in April, according to data released over the weekend.
Asian stocks closed higher, with the Shanghai composite up about 0.8 percent and the Nikkei 225 rising 0.3 percent.
In U.S. economic news, the Empire State Manufacturing report was minus 9.02 in May versus positive 9.56 in April.
Home builder confidence was unchanged for a fourth-straight month , at 58 in May according to the National Association of Home Builders (NAHB).
U.S. stocks closed lower Friday, with the Dow Jones industrial average and S&P 500 below their 50-day moving averages for the first time since February and posting their first three-week losing streak since January.
April retail sales reported Friday topped expectations with a rise of 1.3 percent.
The Dow Jones industrial average (Dow Jones Global Indexes: .DJI) closed up 175.39 points, or 1 percent, at 17,710.71, with Apple leading advancers and Travelers (TRV) the greatest laggard.
The S&P 500 (^GSPC) closed up 19.92 points, or 0.97 percent, at 2,066.53, with energy leading all 10 sectors higher.
The Nasdaq (^IXIC) composite closed up 57.78 points, or 1.22 percent, at 4,775.46.
The CBOE Volatility Index (VIX) (^VIX), widely considered the best gauge of fear in the market, declined to near 14.6.
About three stocks advanced for every decliner on the New York Stock Exchange, with an exchange volume of 865 million and a composite volume of 3.4 billion in the close.
Gold futures for June delivery settled up $1.50 at $1,274.20 an ounce.
—Reuters contributed to this report.
Correction: This story was revised to correct that WTI and Brent settled at their highest since Nov. 3.
On tap this week:
Earnings: Agilent, Virtusa, Akorn
5 p.m. Minneapolis Fed President Neel Kashkari
Earnings: Home Depot, TJX Cos, Red Robin Gourmet Burgers, Vodafone, Children's Place, Momo
8:30 a.m. CPI; housing starts; building permits
9:15 a.m. Industrial production
12 p.m. San Francisco Fed President John Williams, Atlanta Fed President Dennis Lockhart on a panel
1:15 p.m. Dallas Fed President Rob Kaplan
Earnings: Target, Lowe's, SAB Miller, Cisco, Hormel, Staples, Booz Allen, L Brands, Salesforce.com, Analog Devices, Burberry, Take Two Interactive
2 p.m. FOMC minutes
Earnings: Wal-Mart, Gap, Applied Materials, Dick's Sporting Goods, Autodesk, Advanced Auto Parts, Ross Stores, Shoe Carnival, Mentor Graphics, Brocade
8:30 a.m. Jobless claims; Philadelphia Fed survey
10:30 a.m. New York Fed President William Dudley press briefing
Earnings: Campbell Soup, Deere, Foot Locker, The Buckle
10 a.m. Existing home sales
*Planner subject to change.
More from CNBC.com:
- Saudi Arabia holds $117B in US debt: Report
- It just got easier to invest in start-ups
- Tesla calls cheap-labor dispute 'totally unacceptable'
More From CNBC