By the end of key stage 3 they can be up to a year ahead of similar pupils in comprehensives, the National Foundation for Educational Research study found.
Those who just fail the 11-plus and are educated in secondary moderns do slightly worse than their counterparts in comprehensives, but the differences are not nearly as great, say the researchers.
The findings, based on a value-added analysis of the performance of nearly a million pupils in England, will come as a blow to anti-selection campaigners.
The Stop the 11-Plus campaign has collected the signatures required to force 2,000 schools to provide the names of parents eligible to vote in ballots to abolish selection.
Councils involved are Bexley, Bournemouth, Buckinghamshire, Kent, Kingston-upon-Thames, Lincolnshire, Medway, Poole, Reading, Slough, Southend, Sutton, Torbay, Trafford and Wirral (two separate campaigns).
The research, presented to a National Union of TeachersCampaign for State Education conference last Friday, compared the results of 482,399 teenagers at GCSE a with their results at KS3.
Separately, results of 387,595 pupils at KS3 were compared with their earlier KS2 achievements. Both analyses attempted to take pupils' social backgrounds into account by assessing whether a pupil qualified for free school meals.
The study found striking differences at KS3. Among pupils with an average level of 4.5 in KS2 tests, those attending grammar schools were at level 6.3 in KS3 tests three years later.
Those educated in comprehensives averaged only level 5.8, and in secondary moderns, between 5.7 and 5.8. Dr Ian Schagen, who led the study, said that, as one level in the tests equated to two years' progress, middle-ability grammar- school pupils were a year ahead of their comprehensive peers by the end of Year 9.
"Since KS3 results form the foundation for GCSE work, it is reasonable to hypothesise that selective systems produce somewhat better results overall," said the study.
Research last year by Professor David Jesson, of the University of York, said that at GCSE level, schools in areas with selection tended to perform worse.