Parents-to-be wanting to find out their baby's gender can be assured that a blood test on the mother gives an accurate result, say scientists.
The tests, which look for foetal DNA in the mother's blood, are sold privately in many countries, including the UK.
Yet few studies, until now, have scrutinised how well they perform.
US experts examined over 6,000 test results and found it was reliable 98% of the time - providing it was used after the seventh week of pregnancy.
Anything earlier than this made the test unreliable, the Journal of the American Medical Association reports.
And urine-based tests appeared to be unreliable altogether.
A routine ultrasound scan of the baby can only give a gender prediction at about 12 weeks. For couples who need to know the sex of their child for medical reasons - to see if their baby might be affected by a genetic disorder that affects only boys, for example - this wait can seem too long.
Dr Stephanie Devaney, who led the work at the National Institutes of Health in Bethesda, said the blood tests could be useful in clinical settings to aid early detection.
Some hospitals, like Great Ormond Street, already use them to help detect male babies that could have haemophilia.
But critics of the tests argue that the blood tests could also be used for family balancing - where couples will only continue with the pregnancy if, for example, the baby is a girl because they already have three boys.
The review, which looked at 57 studies representing 6,541 pregnancies, found the blood tests gave a genuine result (sensitivity) 95% of the time and that this result was accurate or correct for gender (specificity) 98.6% of the time.
For example, if the test was used by 100 couples, only a few of them would be left still not knowing with certainty what the sex of their unborn child was.
Professor Richard Fleming, of the Glasgow Centre for Reproductive Medicine, said it was important to have confirmation that the tests are valid.
"If you can test from seven weeks of pregnancy then that means knowing the sex a month before a scan could tell you, which is helpful."
He said it could help doctors check for sex-linked genetic conditions earlier. But he said the technology was likely to be used for social reasons.
Dr Gillian Lockwood, medical director of Midland Fertility Services, agreed, saying: "In the UK we would not normally approve of someone who decided to terminate because it was a 'blue' pregnancy rather than a 'pink' one.
"Sex selection for social reasons is illegal in the UK. But there's the danger that this is part of a slippery slope."