Stocks closed mostly higher on Wednesday, helped by better-than-expected earnings and rising oil prices, following the release of key economic data from the Federal Reserve.
The Dow Jones industrial average rose about 40 points, with Goldman Sachs (GS) contributing the most gains. The S&P 500 gained 0.2 percent, with energy rising approximately 1.4 percent to lead advancers.
The energy sector had traded more than 2 percent higher earlier in the session, after the Energy Information Administration reported a 5.3 million crude oil drawdown. West Texas Intermediate futures (New York Mercantile Exchange: @CL.1) for November delivery rose 2.6 percent to settle at $51.60 per barrel.
"It's a combination of energy rising and better-than-expected earnings," said Christian Magoon, CEO of Amplify Investments. "We're just riding that right now."
The Nasdaq composite closed less than 0.1 percent higher.
Earnings season carried on Wednesday, with eight of the 13 S&P components that posted results this morning beating Wall Street estimates, according to Nick Raich, CEO of The Earnings Scout.
Morgan Stanley (MS), Abbott Labs (ABT) and BB&T (BBT) were among the companies that exceeded expectations on both earnings per share and revenue. Morgan Stanley continued the trend of big banks beating forecasts on strong performances from trading.
Dow component Intel (INTC) also reported better-than-expected results Tuesday afternoon, but its stock fell nearly 6 percent on light revenue guidance. Companies scheduled to report are eBay (EBAY), American Express (AXP) and Mattel (MAT), among others.
In economic news, The Fed released the latest iteration of its so-called Beige Book , which summarizes economic conditions in the U.S. In it, the Fed said economic activity increased at a modest pace in most regions.
"The report failed to move the needle in any way. This was as much an in-line report as we've had," said Adam Sarhan, CEO of Sarhan Capital.
The Beige Book was expected to garner more attention than usual as investors search for more clues about when the central bank will raise interest rates.
"Some of the economic news we've gotten has been pretty mixed, but it's been mostly good," said Peter Cardillo, chief market economist at First Standard Financial. Cardillo added he expects the Fed to raise rates in December.
Other economic data released Wednesday included housing start and permits for September. Housing starts fell 9 percent last month , but permits spiked 6.3 percent. Also, U.S. mortgage applications rose 0.6 last week, as higher rates did not deter buyers .
"The bizarre plunge in multi family starts is inexplicable but the rise in permits says it was an outlier," said Peter Boockvar, chief market analyst at The Lindsey Group, in a note.
Elsewhere in the economic calendar, Dallas Fed President Robert Kaplan said the Fed can be patient and raise interest rates gradually. New York Fed President William Dudley is also scheduled to speak Wednesday. San Francisco Fed President John Williams also spoke, but did not comment on monetary policy.
Market participants will also keep an eye on the U.S. presidential election, with Hillary Clinton and Donald Trump scheduled to hold their third and final debate before the election. Clinton currently hold a double-digit lead over Trump, according to an NBC/ Wall Street Journalpoll released Sunday.
"Tonight's debate offers Donald Trump one of his last opportunities to make a dent in the apparently insurmountable lead enjoyed by Hillary Clinton," said Jeremy Klein, chief market strategist at FBN Securities, in a note. "With the former Secretary of State starting to pack her bags for the White House, I doubt that the E-Minis will move much overnight during the broadcast."
"The election balloon is shrinking as we head into the third debate," said Phil Blancato, CEO of Ladenburg Thalmann Asset Management. He also said he expects the market to rally towards the end of the year. " People are going to be happy the election will be over, and that 's going to give them confidence."
U.S. Treasurys were mixed, with the two-year note yield lower around 0.80 percent and the 10-year yield higher at 1.75 percent. The U.S. dollar traded flat to higher against a basket of currencies, with the euro near $1.097 and the yen around 103.4.
Overseas, European stocks traded mostly higher, with the Stoxx 600 (^STOXX) index rising 0.34 percent. In Asia, stocks closed mixed, with the Nikkei 225 rising 0.2 percent and the Hang Seng index falling 0.38 percent.
The Dow Jones industrial average (Dow Jones Global Indexes: .DJI) rose 40.68 points, or 0.22 percent, to close at 18,202.62, with American Express (AXP) leading advancers and Intel the top decliner.
The S&P 500 (^GSPC) rose 4.69 points, or 0.22 percent, to end at 2,144.29, with energy leading eight sectors higher and consumer staples lagging.
The Nasdaq (^IXIC) rose 2.58 points, or 0.05 percent, to close at 5,246.41.
About three stocks advanced for every decliner at the New York Stock Exchange, with an exchange volume of 782.14 million and a composite volume of 3.298 billion at the close.
The CBOE Volatility Index (VIX) (^VIX), widely considered the best gauge of fear in the market, traded lower near 14.3.
Gold futures for December delivery (CEC:Commodities Exchange Centre: @GC.1) rose $7 to settle at $1,269.90 per ounce.
On tap this week:
Earnings: American Express (AXP), Supervalu, Unifirst, Tractor Supply, SLM, Citrix, Canadian Pacific Railroad
7:45 p.m. New York Fed President William Dudley
Earnings: Microsoft, Verizon (VZ), Travelers (TRV), Union Pacific, Bank of NY Mellon, Walgreens BootsAlliance, (WBA) Illinois Tool Works, E*Trade, Dunkin Brands,American Airlines, Alaska Airlines, Pulte Group, Fifth Third, KLA-Tencor, Advanced Micro
7:45 a.m. European Central Bank rate decision
8:30 a.m. New York Fed's Dudley welcoming remarks at NY Fed workshop on financial industry
8:30 a.m. Initial claims
8:30 a.m. Philadelphia Fed survey
10 a.m. Existing home sales
4:45 p.m. New York Fed's Dudley closing comments at workshop on financial services
10:15 a.m. Fed Gov. Daniel Tarullo
2:30 p.m. San Francisco Fed's Williams
More From CNBC