By Lewis Krauskopf

NEW YORK (Reuters) - Soft U.S. economic data weighed on the dollar and Treasury yields on Friday and pressured stock prices, but Wall Street's losses were mitigated by continued gains in oil prices and the Nasdaq inched up for a second straight record high.

Short covering helped extend the rally in oil prices, which tallied their biggest weekly advance since April.

U.S. retail sales were unexpectedly flat in July as Americans cut back on purchases of clothing and other goods, while other data showed producer prices recorded their biggest drop in nearly a year in July.

“That was certainly the headline; I think it spooked a lot of investors this morning," John Traynor, chief investment officer of People’s United Wealth Management in Bridgeport, Connecticut, said of the retail sales report.

"But the underlying news is still very positive," Traynor said. "Wages are growing, employment is growing, and that’s key."

The Dow Jones industrial average <.DJI> fell 37.05 points, or 0.2 percent, to 18,576.47 and the S&P 500 <.SPX> lost 1.74 points, or 0.08 percent, to 2,184.05.

The Nasdaq Composite <.IXIC> added 4.50 points, or 0.09 percent, to 5,232.90.

A 5.6 percent rise in Nvidia's <NVDA.O> shares after the chipmaker's results helped bolster the Nasdaq.

All three indexes closed at record highs on Thursday, the first time they have done so simultaneously since 1999, and they posted slim weekly gains.

Energy shares <.SPNY> were the best-performing S&P sector, rising 0.7 percent and mitigating broader declines as crude prices gained.

The recent "strength in crude has both lifted equity prices and also tended to assuage that fear that we are going into a season of protracted anemic consumer and global demand," said Peter Kenny, senior market strategist at Global Markets Advisory Group in Berkeley Heights, New Jersey. "Crude oil is an enormously important factor right now in the global market."

Oil rose after a short-covering rally was triggered by comments from Saudi Arabia's oil minister in the previous session about possible action to help stabilize the market.

Brent crude futures <LCOc1> settled 2 percent higher at $46.97 a barrel. U.S. crude <CLc1> settled up 2.3 percent at $44.49.

The pan-European STOXX 600 index <.STOXX> fell 0.2 percent after setting a fresh seven-week high, with weakness in mining shares offsetting a surge in A.P. Moller-Maersk <MAERSKb.CO> after its earnings.

MSCI's all-world stock index <.MIWD00000PUS> added 0.1 percent, lingering around year highs.

In the United States, cooling consumer spending and tame inflation suggest the Federal Reserve will probably not raise interest rates any time soon, despite a robust labor market.

The dollar <.DXY> fell 0.1 percent against a basket of currencies.

“The U.S. retail sales data in particular is causing the dollar to weaken,” said Nick Bennenbroek, head of currency strategy at Wells Fargo Securities in New York.

Benchmark U.S. Treasury yields fell to their lowest in nearly two weeks after the economic data, with 10-year Treasury notes <US10YT=RR> last rising 18/32 in price, to yield 1.5118 percent.

"The relationship is pretty straightforward: with low inflation and low growth comes lower interest rates," said Guy LeBas, chief fixed income strategist at Janney Montgomery Scott LLC in Philadelphia.

(Additional reporting by Saqib Iqbal Ahmed, Devika Krishna Kumar, Dion Rabouin and Karen Brettell in New York and Lucia Mutikani in Washington; Editing by Bernadette Baum and James Dalgleish)