Bernardo Silva struck the winning spot kick and Diogo Costa made three saves as Portugal advance to face France.