As she approached the witness stand in a 13th-floor courtroom, Marina Krim stopped midstride and turned to confront Yoselyn Ortega, who sat several feet away at the defense table.

“Oh, God — I just need a good look at you,” Ms. Krim said.

The last time the two women had been face to face was inside a bathroom in the Krims’ Upper West Side apartment five-and-a-half years ago. Ms. Ortega was Ms. Krim’s nanny. The mother had returned home to find two of her children fatally stabbed in a bathtub. Ms. Ortega was plunging the knife into her own neck and was covered in blood. Her eyes “were bugging out,” Ms. Krim said.

The searing testimony opened Ms. Ortega’s trial in State Supreme Court in Manhattan. At times crying, at other times pausing nervously, Ms. Krim recounted step-by-step how a routine afternoon morphed into panic that something had happened to her children — and described the awful moment when she found them.

It was the first time that the mother had spoken in detail publicly about the killings.

Ms. Ortega has been charged with two counts of murder in the first degree and two counts of murder in the second degree. She has pleaded not guilty by reason of insanity, and the trial, which is expected to last about three months, is likely to turn on questions about her mental health history and her state of mind on the day of the slayings.