The gains may have been minor but they were enough to push the S&P 500 to score its highest close of the year for the second day in a row. 

The S&P 500 was up 0.13%, roughly 1% from its all-time high of 2,130 reached in May 2015, as the twin factors of higher oil and a less-hawkish Federal Reserve inspired small gains. The Dow Jones Industrial Average rose 0.1%. An earlier rally faded throughout the afternoon session. 

The Nasdaq, meanwhile, turned lower, weighed on by the health care sector. The tech-heavy index was down 0.14%.

Valeant Pharmaceuticals (VRX)  led the sector lower after another cut to full-year financial projections. The drugmaker has weathered investigations into drug-price increases and its relationship with mail-order pharmacy Philidor Rx.

Biogen (BIIB) - Get Report  was also a major weight on the industry following disappointing results from its Phase 2 study of a treatment for multiple sclerosis. The biotech company had hoped its opicinumab treatment would show both improvement in physical and cognitive function and a slowing of the disability's progression.

"As we have repeatedly expressed, we continue to welcome opportunities to trim our Biogen position into strength," said Jack Mohr and Jim Cramer, co-portfolio managers of Action Alerts PLUS charitable trust portfolio, which holds Biogen.

Wall Street remained mostly positive after a speech from Fed Chair Janet Yellen that implied a June rate hike was unlikely, even as nearly every option was left open. Investors appeared to respond favorably to an absence of hawkish commentary rather than any clearer indication on a tightening timetable.

"In a speech Monday, Chair Yellen highlighted firmer economic momentum while characterizing the latest employment flop as 'disappointing' and 'concerning,'" BNP Parabis analysts wrote in a note. "On balance she remained optimistic, reiterating that the positive economic forces outweigh the negative. It appears the disappointing payrolls report was enough to push the timeframe for the next rate hike from in 'coming months' to something more vague.'"

Crude oil extended Monday's gains as bullish sentiment over an easing supply glut continued. Prices have been buoyed in recent weeks as supply disruptions in Canada and Nigeria and a general downward trend in U.S. production relieved some of the global supply-demand imbalance.

West Texas Intermediate crude oil rose 1.4% to $50.36 a barrel, its highest in 10 months. 

U.S. productivity in the first quarter was revised to a 0.6% drop, according to the Bureau of Labor Statistics, as economists had expected. Unit-labor costs rose 4.5% in the first three months of the year, while increasing 3% in the past year, while the increase in hours worked remained unchanged at 1.5%.

"Chair Yellen mentioned slow productivity growth as an important uncertainty to the outlook of the U.S. economy in the medium term," said Blerina Uruçi, economist at Barclays. "We agree and expect modest productivity growth over the next few years."

PulteGroup (PHM) - Get Report spiked 3.6% in afternoon trading after CNBC reported that Elliott Management has taken a stake. The hedge fund's stake is reportedly between 4% and 5%.

Ralph Lauren (RL) - Get Report slipped 2.4% after announcing plans to cut as much as 10% of its workforce as part of a restructuring plan. The retailer expects to take a restructuring charge of as much as $400 million in fiscal 2017. A number of longtime executives could be affected by the job cuts.

Royal Dutch Shell (RDS.A) increased 3.7% after boosting its expected cost-saving synergies target in a $50 billion acquisition of BG Group. The major oil company expects to see $4.5 billion in synergies in 2018, compared with a previous estimate of $3.5 billion.

Verizon Communications (VZ) - Get Report will likely submit a second-round bid for the core Internet assets of Yahoo! (YHOO) which are worth roughly $3 billion, according to The Wall Street Journal. Privately-held buyout firm TPG will also enter a second-round bid.