Stocks traded above closing records on Tuesday as energy names rallied on a boost to crude oil.

The Dow Jones Industrial Average increased 0.5%, led by Walmart (WMT - Get Report) shares. The S&P 500 was up 0.48%, and the Nasdaq rose 0.3%. The latter's recent gains are the one to watch, said Helene Meisler of Real Money, our premium site for active investors, who pointed out that the tech-heavy index has not had consecutive down days in 2017. 

Markets were on track to close at records Tuesday after just barely eking out fresh highs on Friday before closing for the long weekend. Wall Street was closed on Monday in observance of Presidents Day. 

The energy sector gave markets a boost as crude oil prices rallied to nearly three-week highs. Organization of Petroleum Exporting Countries' Secretary General Mohammad Barkindo said on Tuesday that a rise in U.S. shale production had not threatened the group's output cut agreement. Barkindo also said OPEC would reach out the U.S. as a "strategic partner in the rebalancing process." Barkindo said adherence to a production cut limit had been above 90% in January. 

West Texas Intermediate crude was up 1.1% to $54.33 a barrel on Tuesday. The energy sector was the best performer on markets with the Energy Select Sector SPDR ETF (XLE - Get Report) rising 0.9%.

"Towards the end of 2016, an agreement by members of [OPEC] with some non-OPEC producers to cut oil output sent prices decisively higher," explained Fawad Razaqzada, technical analyst at in a note. "Since then, oil prices haven't really gone anywhere but crucially the pullbacks have been very shallow. This suggests that despite renewed worries about supply surplus in the U.S., market participants are anticipating oil prices to push further higher."

Walmart, the world's largest retailer, climbed 3% after topping fourth-quarter earnings estimates, raising its dividend and guiding for an in-line first quarter. Adjusted fourth-quarter earnings of $1.30 a share came in 2 cents above estimates while same-store sales in the U.S. jumped 1.8%, beating consensus of 1.3%. At its Sam's Club chain, same-store sales rose by 2.4%, double expectations.

For its first quarter, Walmart said it anticipates earnings in the range of 90 cents to $1 a share; Wall Street expects 96 cents. Walmart also raised its dividend by 2% to $2.04 a share. 

Walmart wasn't the only retailer to top estimates. Home Depot (HD - Get Report)  reported a solid quarter which benefited from a healthy housing market. The DIY home-improvement retailer reported 5.8% sales growth at locations open at least a year, higher than estimates of 3.5%. Profit of $1.44 a share was higher than $1.17 a year earlier and exceeded estimates of $1.34. Home Depot also increased its dividend to 89 cents from 69 cents and authorized a fresh $15 billion share buyback program. 

Macy's (M - Get Report)  beat analysts' quarterly estimates on its bottom line. The department store chain earned an adjusted $2.02 a share, 7 cents above estimates. Revenue came in weaker than expected, falling 4% to $8.52 billion and missing expectations of $8.61 billion. Fourth-quarter same-store sales fell 2.1%. The company said it anticipates fiscal 2017 sales to fall by 3.2% to 4.3% and for adjusted earnings to come in between $2.90 and $3.15 a share, wrapping around consensus of $3.05. 

Better-than-expected earnings from retailers came as a relief to investors who were wary heading into the industry's portion of the earnings season. Expectations have been relatively low for the majority with several retailers, including Macy's and Target (TGT - Get Report) , already having warned of weaker sales over the Christmas season. Slower traffic at malls and cautious consumer spending are expected to have contributed to retail weakness. Retail earnings are expected to increase by 5.2% over the fourth quarter, according to Thomson Reuters estimates.

Also in retail earnings this week, L Brands (LB - Get Report) and TJX Cos. (TJX - Get Report)  will report on Wednesday; Gap (GPS - Get Report) , Kate Spade (KATE) , Kohl's (KSS - Get Report) and Nordstrom (JWN - Get Report) on Thursday; and Foot Locker (FL - Get Report) and J.C.Penney (JCP - Get Report) on Friday.

Manufacturing activity in the U.S. softened in February, though remained in expansion territory. The Markit U.S. flash manufacturing PMI declined to 54.3 in February, down from 55 in January. Analysts expected the measure to increase to 55.2. The services gauge fell to 53.9 this month from 55.6 in January.

Yahoo! (YHOO)  moved 0.5% higher following a Wall Street Journal report that Verizon (VZ - Get Report) agreed to go forward with its acquisition of the Internet company. Verizon will reportedly shave off as much as $350 million from the original $4.83 billion offer. The deal had been in jeopardy after news broke last year of a hack that had compromised more than 1 billion accounts.

EyeGate Pharmaceuticals (EYEG - Get Report) rocketed 60% higher after entering into a licensing agreement with Valeant Pharmaceuticals (VRX) . Valeant will exclusively deal with the commercial and manufacturing rights of EyeGate's EyeGate II Delivery system and EGP-437 products. Though financials were not disclosed, EyeGate will receive cash upfront on the deal, as well as milestone and sales payments. 

Wells Fargo (WFC - Get Report) announced Tuesday afternoon that it had terminated four senior managers in community banking as part of its investigation into its sales practices. The board unanimously voted to fire the employees. The bank's investigation is expected to conclude before its annual meeting in April. 

Wells Fargo is a holding in Jim Cramer's Action Alerts PLUS Charitable Trust Portfolio. Want to be alerted before Cramer buys or sells WFC? Learn more now.

Apple (AAPL - Get Report) traded at an all-time high of $136.62 on Tuesday after Morgan Stanley hiked its price target on the tech giant to $154 from $150. The firm said it saw increased sales optimism in China, representing "outsized growth" in fiscal 2018. Morgan Stanley has increased its fiscal 2018 iPhone estimates by 3%. 

Apple is a holding in Jim Cramer's Action Alerts PLUS Charitable Trust Portfolio. Want to be alerted before Cramer buys or sells AAPL? Learn more now.

Popeyes Louisiana Kitchen (PLKI)  surged 19% after agreeing to be acquired by Restaurant Brands International (QSR - Get Report)  in a deal worth $1.8 billion. Restaurant Brands will pay $79 a share, a 27% premium over Popeyes' 30-day volume weighted average price as of Feb. 10, the last day before reports surfaced that Restaurant Brands was mulling a bid. Restaurant Brands said in a statement that Popeyes will be managed independently in the United States "while benefitting from the global scale and resources of RBI."

HSBC (HSBC)  shares were sharply lower after Europe's biggest bank posted much lower-than-expected full-year earnings. Pretax full-year profit was $7.1 billion, down 62% from 2015 and well shy of the $14.4 billion forecast by analysts. HSBC said its bottom line was hit by a $3.2 billion goodwill write-down on its private banking division in Europe, which was linked to the purchase of Safra Republic Holdings in 1999. HSBC added $1 billion to its share buyback program, taking the total amount of the program to more than $3.5 billion.

Kraft Heinz (KHC - Get Report) slumped after scrapping its pursuit of Unilever (UL) . Kraft had offered a $143 billion takeover deal to Unilever last week, an offer Unilever said undervalued the company. The two said on Sunday that Kraft had "amicably agreed" to withdraw its proposal. Kraft said it had wanted to pursue friendly negotiations, but backed off when Unilever expressed no interest. 

Kraft Heinz is a holding in Jim Cramer's Action Alerts PLUS Charitable Trust Portfolio. Want to be alerted before Cramer buys or sells KHC? Learn more now.