US stock indexes finished slightly higher on Monday as investors let go of some of their fears about a possible trade war with China, although bigger gains slipped away as the market suffered a steep afternoon decline.
Stocks climbed higher in the first hours of trading and, at about 2pm, the Dow Jones industrial average was up 440 points.
That put the market on track to make up almost all of the ground it lost during a big sell-off on Friday.
However, stocks have repeatedly changed course as investors tried to guess the outcome of the US-China trade dispute and they did it again Monday afternoon.
Health care companies finished with strong gains and technology companies like Microsoft and Apple regained some of their recent losses. Banks rose along with interest rates.
However, industrial and retail companies finished with losses, and smaller firms fared worse than larger ones.
Marina Severinovsky, an investment strategist at Schroders, said stocks have done well recently when investors have got their minds off the trade disputes because the global economy and the US economy are still growing.
The S&P 500 index gained 8.69 points, or 0.3%, to 2,613.16. The S&P 500 fell 1.4% last week, with large losses on Monday and Friday, and strong gains in between.
The Dow Jones industrial average rose 46.34 points, or 0.2%, to 23,979.10. The Nasdaq composite jumped 35.23 points, or 0.5%, to 6,950.34. The Russell 2000 index of smaller company stocks added 1.17 points, or 0.1%, to 1,514.46.
Most of the stocks on the New York Stock Exchange finished lower on Monday.
Swiss drugmaker Novartis agreed to buy AveXis for 8.7 billion US dollars (£6.15 billion), or 218 dollars (£154) a share, as it aims to become a leader in the treatment of neurodegenerative diseases.
AveXis is studying a treatment for a disorder called spinal muscular atrophy Type 1, which Novartis called the top genetic cause of death in infants.
AveXis climbed 94.55 dollars (£66.92), or 81.6%, to 210.46 dollars (£148.97) and Novartis added 87 cents (61p), or 1.1%, to 81.07 dollars (£57.38).
Agribusiness company Monsanto jumped 7.29 dollars (£5.15), or 6.2%, to 125.15 dollars (£88.58) after The Wall Street Journal reported the Department of Justice will approve its sale to German conglomerate Bayer.
This week will be a big one for Facebook as it tries to get its data privacy scandal under control.
Chief executive Mark Zuckerberg is meeting legislators and will testify before Congress later this week as the company has embarked on a high-profile effort to convince users, advertisers and investors that it is serious about fixing problems that led to the Cambridge Analytica scandal and about user privacy as a whole.
Facebook picked up 73 cents (51p) to 157.93 dollars (£111.78). Its stock is down almost 15% since March 16.
Bond prices fell. The yield on the 10-year Treasury note rose to 2.78% from 2.77% late Friday.
Benchmark US crude jumped 1.36 dollars (96p), or 2.2%, to 63.42 dollars (£44.89) a barrel in New York. Brent crude, used to price international oils, added 1.54 dollars (£1.09), or 2.3%, to 68.65 dollars (£48.59) a barrel London.
Wholesale gasoline rose 3 cents to 1.98 dollars (£1.40) a gallon, heating oil rose 4 cents to 2 dollars (£1.42) a gallon, and natural gas lost 1 cent to 2.69 dollars (£1.90) per 1,000 cubic feet.
Gold rose 4 dollars (£2.83) to 1,340.10 (£948.52) an ounce, silver gained 17 cents to 16.53 dollars (£11.70) an ounce, and copper picked up 2 cents to 3.08 dollars (£2.18) a pound.
The dollar fell to 106.78 yen from 106.85. The euro rose to 1.2322 dollars from 1.2285.