Doesn't seem that hard. Have them leverage their success in the War of the Pacific to obtain high levels of investment from Europe and the US. Have them then leverage their mining industry into increased internal development and military expansion. Basically it'd be pulling a Meiji in economic terms. As a matter of fact, I can't quite see why they failed to do this in OTL. I know the nitrate supply was invalidated by the development of synthetic nitrates, but if they expand their economy to include large-scale mining they should fare pretty well. Beyond that they just have to avoid political instability, possibly by allying with the US and sticking with that alliance.