Every male gymnast in London performed a routine on all six apparatus, determining which of the eight teams and which individuals will compete for the various gold medals to be awarded in the coming week.
The supposedly powerful Chinese team qualified only sixth while the Americans posted a clear advantage over the second-place Russians.
The United States finished with a team score of 275.342 to 272.595 for Russia. Britain finished third with 272.420 points. The rest of the eight qualifiers for the team gold medal included Germany, Japan, China, Ukraine and France.
Leyva's individual total was 91.265 points. David Belyavskiy of Russia was second, followed by Fabian Hanbuchen of Germany, John Orozco of the United States, Kristian Thomas of Britain and Mykola Kuksenkov of Ukraine.
Qualifying points will be thrown out when the team finals are held Monday. The individual all-around gold medal will be handed out Wednesday.
Women's qualifying will take place Sunday.
China won the men's team gold medal four years ago, followed by Japan and the United States.