“That was an excuse by the Democrats, who lost an election that some people think they shouldn’t have lost,” he said. “But we were very, very happy, and, frankly, James Comey confirmed a lot of what I said, and some of the things that he said just weren’t true.”

The remarks were a defiant response from Mr. Trump, who had remained uncharacteristically silent on social media during Mr. Comey’s blockbuster day of testimony on Thursday, as the former F.B.I. chief laid out an account that strongly suggested the president’s private exchanges with him had been an attempt to obstruct justice. They escalated an extraordinary public feud between a sitting president and the ousted F.B.I. director who had been investigating his campaign, each now engaging in full-throated accusations that the other is lying.

But Mr. Trump’s comments reflected a highly selective reading of Mr. Comey’s testimony, much of which painted a damaging picture of the president’s conduct. Mr. Comey told Congress that the president had not personally been under investigation while he was the F.B.I. director, and that at one point Mr. Trump suggested he would like to find out whether any of his associates had done anything wrong. But his account also strongly suggested that Mr. Trump had tried to influence his handling of the Russia inquiry.

Mr. Trump denied that he had ever asked Mr. Comey to drop the F.B.I. investigation into his former national security adviser’s dealings with Russia, or asked for a pledge of loyalty, as Mr. Comey asserted Thursday. Those conversations are reflected in memos Mr. Comey wrote, and now are in the possession of Robert S. Mueller III, the special counsel in the Russia investigation who was named after Mr. Comey’s firing.