During the Pacific War, he organized the "Battle of Tambo valley". In that battle, he was a commander Vanguard division. He prevented the Chilean enemies from leaving. In 1895, he gave a service that gave drinkable water to his hometown. Piérola's made a revolution earlier that year. López then decided to become a politician. He was put on Congress as a deputy of his hometown, Arequipa. He was elected to the first vice-presidency of his house, and became a minister for development, 1896. As a minister, he helped build irrigation systems, roads, mining, and industry. In 1897 he was elected Mayor of Arequipa. As a mayor, he did an excellent job, as he gave Arequipa urban planning and road works. He returned to congress again in 1898, and was a senator in 1899. 