NEW YORK (Reuters) - The S&P 500 ended flat while the Dow edged down and the Nasdaq closed higher in light trading on Friday as Canada and the United States concluded trade talks without resolution ahead of the Labor Day weekend.

Capping a low-volume, late-summer week marked by tariff-related volatility, all three major U.S. indexes posted net gains for the period. The indexes were also up for the month of August, with the Nasdaq posting its largest monthly gain since January.

Talks between Canada the United States to renegotiate the North American Free Trade Agreement (NAFTA) ended on a sour note as the two sides were unable to reach a deal, according to the Wall Street Journal.

In recent days trade jitters abated as Mexico and the United States reached a bilateral deal, but re-emerged later in the week following a report that U.S. President Donald Trump is prepared to impose tariffs on an additional $200 billion of Chinese imports as soon as next week.

“We may not have a replacement for NAFTA as quickly as we thought,” said John Toohey, head of equities at USAA in San Antonio. “That initial optimism that existed at the beginning of the week, that good news scenario is off the table.”

Amazon.com's shares AMZN.O continued to inch upward, rising 0.5 percent as investors watch the company close in on its $1 trillion market share milestone.

Apple Inc AAPL. closed up 1.2 percent, reaching a new closing high for the fifth straight session.

Slideshow ( 4 images )

The Dow Jones Industrial Average .DJI fell 22.1 points, or 0.09 percent, to 25,964.82, the S&P 500 .SPX gained 0.39 points, or 0.01 percent, to 2,901.52 and the Nasdaq Composite .IXIC added 21.17 points, or 0.26 percent, to 8,109.54.

Of the 11 major sectors in the S&P 500, five closed lower.

Coca-Cola Co KO.N agreed to buy the coffee chain Costa from Britain's Whitbread PLC WTB.L for $5.1 billion.. Its shares dipped 0.8 percent.

Tesla Inc TSLA.O had a fifth consecutive decline following news that fund manager BlackRock voted in favor of replacing Elon Musk with an independent chairman.

Gun maker American Outdoor Brands AOBC.O was the top percentage gainer on the Nasdaq. The stock soared 43.6 percent after its upbeat earnings report. Peer Sturm Ruger & Co RGR.N shares jumped 7.3 percent.

Chipotle Mexican Grill CNG.N shares extended their loss, dipping 1.8 percent after William Ackman's Pershing Square cut its stake in the burrito chain.

Slideshow ( 4 images )

Ford Motor Co F.N dropped 2.3 percent after scrapping a plan to sell a Chinese-made small vehicle in the United States due to tariff concerns.

Advancing issues outnumbered declining ones on the NYSE by a 1.16-to-1 ratio; on Nasdaq, a 1.60-to-1 ratio favored advancers.

The S&P 500 posted 34 new 52-week highs and 3 new lows; the Nasdaq Composite recorded 121 new highs and 29 new lows.

Volume on U.S. exchanges was 5.77 billion shares, compared with the 6.08 billion average for the full session over the last 20 trading days.