And children who were distressed at the time were more likely to be confused about what had happened to them. Previous research suggests that this sense of confusion may cause problems when they face further medical situations later in life.
The researchers, from the University of New South Wales in Sydney, Australia, say the findings suggest that it is important to do everything possible to explain medical procedures to children.
They found that two-year-olds can remember some details of an invasive procedure they underwent six months earlier.
Children whose parents talked to them about the procedure remembered the experience more clearly and were less likely to confuse it with other frightening experiences.
Researcher Dr Karen Salmon said: "Our findings challenge earlier views that young children tend not to recall medical events."
When asked in general terms about their hospital experience, children gave few details about it. But those they did give tended to be accurate.
In contrast, prompting from interviewers led to the children offering more details about the procedure, but less accurate reports as well.
"Errors in children's recall of medical procedures may have negative repercussions, such as an increased risk of confusions amongst various medical experiences and heightened distress during subsequent medical encounters," the researchers say.
Confusion
The study included 32 children between ages two and seven who had undergone an X-ray of the kidneys that many children find highly distressing.
The children and their parents were interviewed six months after the procedure. The researchers also had videotapes of the children undergoing the procedure from an earlier study.
Children and parents who talked about the procedure, either during it or afterward, had more accurate memories of the experience.
Children who were distracted by talk of other subjects or by crying during the procedure provided less accurate accounts six months later.
Dr Salmon said it was likely that children - and adults - might be better able to cope if they had a full and accurate memory of a medical procedure that they had undergone.
For that reason children may benefit from talking about the procedure so that they gain a greater understanding of it
However, distraction techniques might be appropriate to divert attention at a particularly stressful or painful stage of the proceedings.
'Unthreatening'
A spokesperson for the Royal College of Paediatrics and Child Health told BBC News Online: "This would seem sensible advice.
"One would expect paediatricians to be able to communicate effectively with even young children."
Dr Harvey Marcovitch, editor of the journal Archives of Disease in Childhood, said UK paediatricians were sensitive to the emotional needs of young children.
"It is the reason why children are not admitted to hospital unless it is essential, kept in for the minimum time and why there are schemes all over the country for day case or outreach nursing care."
Dr Marcovitch said it was almost impossible to explain hospital procedures to a child.
The best approach was to try to minimise their distress, mainly by making sure a parent was present.
However, it was also a good idea to try to make their surrounds as unthreatening as possible, and to use methods such as anaesthetic cream to reduce pain.
The research is published in the Journal of Developmental and Behavioral Pediatrics.