traders
Traders work on the floor of the New York Stock Exchange, Feb. 11, 2016. Eduardo Munoz Alvarez/Getty Images

This story was updated at 4:15 p.m. EDT.

With little U.S. economic data out Friday, investors turned to something that has been the standard bearer for global markets for months: oil prices. U.S. stocks followed crude up in the last trading session of the week, hitting highs for the year for a second day in a row. Oil tipped lower in afternoon trading but stocks coasted to the closing bell in the green, their fifth consecutive weekly increase and the longest streak in two years.

"Clearly the market has decided the best way to figure out what's going on with global growth is to look at oil," Chuck Self, chief investment officer at iSectors, told CNBC late Thursday amid a two-day rally that’s added about 10 percent to the price of a barrel of crude since the middle of the week.

The Dow (INDEXDJX:.DJI) closed up 117.52 points, or 0.67 percent, to 17,599.01. The broader Standard & Poor’s 500 index (INDEXSP:.INX) rose 8.93 points, or 0.44 percent, to 2,049.52. The Nasdaq composite (INDEXNASDAQ:.IXIC) gained 20.66 points, or 0.43 percent, to 4,795.65.

The Dow gained 2.2 percent for the week and is up 1 percent for the year. The S&P rose 1.4 percent since Monday and is up 0.3 percent for the year. The Nasdaq gained 1 percent this week but is still down for the year.

Seven out of the 10 S&P 500 sectors closed up, led by healthcare and financials stocks. Goldman Sachs Group Inc. (NYSE:GS) led Dow Industrial advances while Microsoft Corp. (NASDAQ:MSFT) led declines.

A two-day oil-price rally ended Friday afternoon on profit taking and the release of a weekly report on active North American oil rigs that showed an increase of one, ending 12 consecutive weeks of decline. Oil prices have gained more than 50 percent from its lowest price in more than a decade in mid-February, helped by OPEC’s signal of a possible production freeze to stabilize prices.

U.S. West Texas Intermediate was down 2.19 percent to $39.32 a day after settling at its highest price since Dec. 3. Brent crude, the other major global oil-price benchmark, fell 0.34 percent to $41.40.

The benchmark U.S. 10-year Treasury fell to 1.88 percent from the previous session’s close of 1.91 percent. The bond yield typically rises when investors are more confident about the markets and falls when concerns flare and demand for U.S. debt increases. Gold, another so-called safe harbor investment, fell 0.84 percent to $1,254.40 per troy ounce. Gold prices tend to rise as confidence in the markets falls.

European shares ended the last trading session of the week mostly in the green despite a drop in bank stocks earlier in the day. A weaker euro spurred a rally in automotive shares and in other companies reliant on exports. The broad pan-European Stoxx Europe 600 closed up 0.34 percent. The Paris-based CAC 40 gained 0.44 percent while London’s FTSE lost 0.19 percent. Frankfurt’s DAX advanced 0.59 percent.

Asian stocks ended the last trading session of the week mostly higher, helped in part by signs of property market improvement in China and a rebound in commodity prices. China’s broad CSI 300 Index of the mainland’s largest companies closed up 1.53 percent. Hong Kong’s Hang Seng advanced 0.89 percent. Japan’s Nikkei lost 1.25 percent. Australia’s S&P/ASX 200 rose 0.29 percent. South Korea’s main Kospi Index rose 0.21 percent.