The city was first founded in 1561 by Spanish explorer Ñuflo de Chavez about 200 kilometers east of its current location, and was moved several times until it was finally established on the Pirai River in the late 16th century.