Stocks are closing higher Thursday as investors grow cautiously optimistic the US and China can make progress in upcoming trade talks, the AP reports. The S&P 500 gained 8 points, or 0.3%, to 3,009, led by technology and consumer-focused companies, although the rally lost some steam in the final minutes of trading. Microsoft rose 1% and PayPal added 3%. Shares of Amazon gained 1.1% while Hasbro rose 1.8%. Energy was the worst-performing sector as the price of oil fell 1% to $55.09 a barrel. Marathon Oil dropped 3.4%. The Dow Jones industrials rose 45 points, or 0.2%, to 27,182 after being up about 170 points earlier. The Nasdaq gained 24 points, or 0.3%, to 8,194. Bonds fell. The yield on the 10-year Treasury rose to 1.78% from 1.73% a day earlier. (More stock market stories.)