Qrd: Previously she was indeed elected as head of the LDP, so her election as Prime Minister was almost taken for granted, but it got put in jeopardy by the historic allied party Komeitō leaving the coalition over differences, even leading to the idea of making PM someone from an opposition party instead being floated around, but at the last minute yesterday the Japan Innovation Party backed her after some negotiations, finally reaching the number needed to break the deadlock.
Just now, the National Diet had the vote and she finally won the premiership.