E9 858 then FR 394 at Madrid
San José (Costa Rica) → Madrid → Ibiza
Timetable, Madrid time
15:10E9 858 from San José (Costa Rica) at the gate
13:30FR 394 to Ibiza leaves the gate
22 h 20 apart on the timetable, overnight
FR 394 leaves 22 h 20 after E9 858 arrives on the timetable: more than half a day, so not a connection we count.