U.S. stocks closed more than half a percent higher Wednesday as investors eyed a jump in oil prices and looked ahead to the Federal Reserve's decision on a rate hike. (Tweet This)
"It's all about waiting for tomorrow. Right now you're seeing the market being positive. The consensus is the Fed is not going to do anything," said Jeff Carbone, co-founder and managing partner of Cornerstone Financial Partners.
The Dow Jones industrial average closed about 140 points higher, after adding as much as 156 points in the minutes before the close. Chevron led the index higher.
The energy sector ended 2.77 percent higher, to lead S&P advancers.
The S&P 500 broke resistance at 1,993 and ended within 5 points of the psychologically key 2,000 level.
The Dow ended above its recent closing high hit Aug. 28, which means "we're going to rally into the 50-day moving average," said Adam Sarhan, CEO of Sarhan Capital.
In the last few weeks, both the Dow and the S&P formed the so-called death cross in which the 50-day moving average falls below the 200-day.
Gains in oil "should cushion any declines in the market today," said Peter Cardillo, chief market economist at Rockwell Global Capital. He also noted options expirations Friday and short covering ahead of the Fed's Thursday announcement.
Weekly crude oil inventories unexpectedly fell, supporting further gains in oil prices. Crude surged more than 5.5 percent, while brent was briefly up more than 7 percent above $50 a barrel.
Crude oil futures for October delivery settled up 5.7 percent at $47.16 a barrel. Gold futures ended up $16.40, to $1,110.90 an ounce, their highest level since last week.
The Federal Open Market Committee could raise short-term interest rates for the first time in nine years at its two-day meeting that began Wednesday. All eyes are on Thursday afternoon's expected statement and press conference.
"You don't have a market-moving piece of news in this market that seems to have come into today in a bit of equilibrium," Art Hogan, chief market strategist at Wunderlich Securities, said of the opening stock index moves. "I think it tells us nobody has an idea what the Fed is going to do tomorrow.
In morning trade, the Dow briefly turned negative and tried to stay with the S&P 500 in positive territory. The Nasdaq composite also reversed slight losses to trade mildly higher.
Treasury yields held near highs hit Tuesday, with the 10-year at 2.29 percent and the at a four-year high of 0.82 percent.
"The bond market is hedging itself against an eventual increase (in rates)," said Ben Pace, chief investment officer at HPM Partners.
The U.S. dollar reversed to trade about a third of a percent lower against major world currencies, with the euro just below $1.13 and the yen around 120.6 yen against the greenback.
Wall Street is divided over whether the central bank will decide to raise rates. Forty-nine percent of respondents to CNBC's Fed Survey forecast a rate hike will come at the current meeting.
"I think (Thursday) afternoon the only thing I can guarantee is volatility for two hours," said James Meyer, chief investment officer at Tower Bridge Advisors.
Stocks rallied more than 1 percent Tuesday, more than recouping Monday's mild losses. The Dow Jones industrial average joined the other major averages to end within 10 percent of its 52-week high, out of correction territory.
The Russell 2000 closed out of correction mode Wednesday.
"I think (Tuesday's) rally was sending a message to the Fed to go and raise rates, preparing the way for a solid fourth quarter for equities," Cardillo said.
Most strategists said the rally meant the Fed would hold off on tightening Thursday.
"It seems like the investors are optimistic that the Fed is going to stand pat and keep rates low," said Jack Ablin, chief investment officer at BMO Private Bank. "The Fed is stuck. They missed an opportunity."
Analysts mostly looked past the last key data out ahead of the Fed meeting. August CPI, showed a decline of 0.1 percent, its first drop in seven months. The ex-food and energy figure rose 0.1 percent.
"The Fed can well afford to wait given inflation remains contained," said John Lonski, chief economist at Moody's.
In continued signs of strength in the housing sector, the September home builder sentiment rose one point to 62, the highest since 2005.
In early morning trade, U.S. stock futures were mostly flat. The Dow futures rose almost 50 points before dipping in and out of negative territory.
European shares closed higher, with the STOXX Europe up about 1.5 percent.
In Asia, China's benchmark Shanghai Composite index staged a late-day rally to close almost 5 percent higher — adding to upbeat sentiment in global stock markets.
On the earnings front, FedEx reported quarterly profit of $2.42 per share, 4 cents below estimates, with revenue matching forecasts. CEO Fred Smith said the company is doing well considering weaker than expected global economic conditions. Separately, FedEx will increase rates by 4.9 percent at its FedEx Express service, effective Jan.4. The stock closed down 2.84 percent.
Oracle was upgraded to "buy" from "neutral" at SunTrust, which cites increasing opportunities for Oracle's cloud-based business as well as valuation. Oracle ended the session 0.74 percent higher, ahead of its earnings release after the close.
The Dow transports closed up 0.24 percent to hold above its 50-day moving average.
The closed up 17.22 points, or 0.87 percent, at 1,995.31, with energy leading nine sectors higher and telecommunications the only decliner.
The CBOE Volatility Index (.VIX), widely considered the best gauge of fear in the market, traded near 22.
About three stocks advanced for every decliner on the New York Stock Exchange, with an exchange volume of 881 million and a composite volume of 3.6 billion in the close.
On tap this week:
FOMC meeting begins
4 p.m.: TIC data
Final day of FOMC meeting
8:30 a.m.: Initial claims
8:30 a.m.: Housing starts
8:30 a.m.: Current account
10 a.m.: Philadelphia Fed survey
2 p.m.: Fed statement
2:30 p.m.: Fed Chair Janet Yellen news briefing
10 a.m.: Leading indicators
1:30 p.m.: San Francisco Fed President John Williams on the economic outlook
3:30 p.m.: St. Louis Fed President James Bullard on the economy and monetary policy
More From CNBC.com: