Francisco Sagasti was elected as lawmakers met to try to find a way out of a political crisis, sparked by the impeachment of one popular president and the resignation of his controversial successor, amid protests which killed two people.
Sagasti, a centrist, will serve as interim president until the end of July 2021, completing the mandate of Martin Vizcarra, who was impeached by Congress last Monday.
His successor, former Congress speaker Manuel Merino, resigned on Sunday after days of street protests during which two demonstrators were killed.
Congress was meeting for a second time to agree a president and Sagasti secured the minimum 60 votes required.
A first attempt by the legislature to agree on a president failed on Sunday, when leftist lawmaker Rocio Silva Santisteban, won just 42 votes.