Place rice into a fine mesh strainer and rinse with cold water, moving the rice around with your fingers until the water runs clear. Drain well and set aside.
Heat a medium saucepan with a tight-fitting lid over medium heat. Add the oil or butter. When hot, add the rinsed rice and onion. Cook, stirring often, until the rice turns from translucent to a brighter white and the onion is soft, about 3 to 4 minutes.
Add the garlic and cook, stirring it around the pan until fragrant but not browned, about 30 seconds.
Pour in the warm water or stock and stir, knocking any grains of rice stuck to the pan’s sides. Season with salt, bring to a boil, and then reduce the heat to the lowest setting and cover with a lid. Cook, covered, for 15 minutes.
Remove the pan from the heat and leave alone (still covered) for 10 minutes.
Uncover and test a grain of rice. If the rice is still a little hard, put the lid back on and cook over low heat for another 5 minutes. If the rice looks too dry, scatter a tablespoon or two of extra water over it before placing it back on the heat.
When the rice is done, scatter the lime juice and cilantro on top. Use a fork to gently fluff the rice and incorporate the lime juice and cilantro. Serve.
