The stock market erased an early drop and ended mixed Friday, capping a strong week and month.

Stocks rebounded after President Donald Trump outlined several actions in response to a move by China to exert more control over Hong Kong, but steered clear of upending a trade pact struck with Beijing earlier this year.

Technology and health care stocks accounted for much of the market’s gains. That helped offset losses in banks, industrial companies and elsewhere. Bond yields fell and gold prices rose, signs that investors remain cautious. Oil recovered from an early slide.

On Friday:

The S&P 500 rose 14.58 points, or 0.5%, to 3,044.31.

The Dow Jones Industrial Average fell 17.53 points, or 0.1%, to 25,383.11.

The Nasdaq composite gained 120.88 points, or 1.3%, to 9,489.87.

The Russell 2000 index of small company stocks gave up 6.64 points, or 0.5%, to 1,394.04.

For the week:

The S&P 500 gained 88.86 points, or 3%.

The Dow rose 917.95 points, or 3.8%.

The Nasdaq climbed 165.29 points, or 1.8%

The Russell 2000 picked up 38.50 points, or 2.8%.

For the year:

The S&P 500 is down 186.47 points, or 5.8%.

The Dow is down 3,155.33 points, or 11.1%.

The Nasdaq is up 517.27 points, or 5.8%

The Russell 2000 is down 274.43 points, or 16.4%.