First of all, it is stretching things a little to say that America was a world leader at the end of the 19th century. The US was still only a second-rate power at that time.
To the extent that the US "improved" over this time, it was because of the geographic and economic growth of the country after the Civil War. The US extended itself across the continent and had all the resources of that huge area to industrialize itself during these decades. This allowed the country to become richer at a time when economic and industrial power translated to military power.
The US "improved" then, by expanding geographically and in terms of industry.