The S&P 500 and Nasdaq Composite rose marginally on Tuesday — eking out fresh record closing highs — as investors digested testimony from the top U.S. central banking official and assessed the potential economic impact of the coronavirus.

The broad index closed 0.2% higher at 3,357.75. The Nasdaq was up 0.1% at 9,638.94. The Dow Jones Industrial Average rose as much as 138 points before closing flat at 29,276.34. The three major averages hit intraday records earlier in the day.

Federal Reserve Chairman Jerome Powell testified in front of the House Financial Services Committee that the central bank is "closely monitoring" the coronavirus situation for a potential hit to China and the global economy. During the Q&A portion of his testimony, Powell noted it is "too early to say" how the coronavirus will ultimately impact the U.S. economy.

"The coronavirus clearly presents a risk to the global economy," said Danielle DiMartino Booth, CEO of Quill Intelligence. "The Chinese economy is four times greater than it was during the SARS outbreak and China has established itself as the most critical link in the global supply chain."

Investors have been grappling with fears that of the coronavirus denting global economic growth.

China's National Health Commission on Monday night said the death toll had risen to 1,016 people with 42,638 confirmed cases. However, data from Johns Hopkins University showed the number of new confirmed cases was its lowest since late January, increasing optimism around the country's efforts to contain the outbreak.

Fears over the economic fallout from the outbreak have also been offset by positive economic indicators. Jobs data released last week easily beat analyst expectations while U.S. manufacturing and services activity show signs of improvement.

Both the S&P 500 and Nasdaq Composite closed at fresh highs on Monday, while the Dow jumped more than 170 points.