FR 573 then FR 5897 at Madrid
Porto → Madrid → Torino
Timetable, Madrid time
13:30FR 573 from Porto at the gate
10:10FR 5897 to Torino leaves the gate
20 h 40 apart on the timetable, overnight
FR 5897 leaves 20 h 40 after FR 573 arrives on the timetable: more than half a day, so not a connection we count.