At the age of six months, most babies have barely learnt to sit up, let alone crawl, walk or talk.
But, according to new research, they can already assess someone's intentions towards them, deciding who is a likely friend or enemy.
US scientists believe babies acquire the ability to make social evaluations in the first few months of life.
It may provide the foundation for moral thoughts and actions in later years, they write in the journal Nature.
"By six months, babies have learnt quite a lot and they are taking things in," said Kiley Hamlin, lead author of the research.
"We can't say that it is hard-wired (exists in a newborn baby) but we can say it is pre-linguistic and pre-explicit teaching," she told BBC News.
"We don't think this says that babies have any morality but it does seem an essential piece of morality to feel positive about those who do good things and negative about those who do bad things - it seems like an important piece of a later more rational and moral system."
Infant lab tests
Like all social creatures, humans are able to make rapid judgements of other people based on how they behave towards others. But the roots of this behaviour and when it develops are not well understood.
Kiley Hamlin and colleagues at Yale University devised experiments to test whether babies aged six and 10 months were able to evaluate the behaviour of others. They used wooden toys of different shapes that were designed to appeal to babies.
The babies were sat on their parents' laps and shown a display representing a character trying to climb a hill.
The climbing character, which had eyes to make it human-like, was either knocked down the hill by an unhelpful character (a toy of a different shape and colour) or pushed up the hill by a helper cartoon figure (another shape and colour).
After watching the "puppet show" several times, each baby was presented with the helper and hinderer toys and asked to pick one.
All of the 12 six-month-old babies tested and 14 of the 16 10-month-olds reached out to touch the helper character rather than the anti-social one.
Further experiments were carried out to rule out other explanations for the behaviour - such as a preference for pushing up or down actions or the appearance of certain characters.
"Our findings indicate that humans engage in social evaluation far earlier in development than previously thought, and support the view that the capacity to evaluate individuals on the basis of their social interactions is universal and unlearned," the authors wrote in Nature.
Evidence that babies so young show some social intelligence comes as no surprise to Kiley Hamlin. She said one message for parents is that babies are able to figure out a lot on their own.
"They are quite competent social creatures early on," she said. "They figure out the good guys to hang out with without much help."
Professor Oliver Braddick of the University of Oxford, UK, who was not part of the research study, agreed.
"It shows how prepared babies are to learn the basics of social interaction at a very early age," he said.
But he said it is not yet clear whether the capacity described by the Yale group relates to a real understanding of social life.
"These babies are recognising interaction between other beings they are watching," he said.
"These interactions we can imagine are a foundation for social understanding but I'm not sure yet they truly reflect social understanding in the sense we would apply to an adult or older child."
Previous research has shown that babies in the first six months of life show preferences for others based on the attractiveness of their face.
But it is not until the age of 18 months that toddlers are true social creatures, and will cooperate with others of their own accord.