Take the bus from Lisbon to Fatima (runs hourly) via the stop named Cova de Iria, as described in Rick's Portugal guidebook and at http://lisbon-portugal-guide.com/lisbon-transport/Lisbon-to-Fatima-Transport.php. The train station Fatima-Caho de Macas shown on some maps and train schedules is a half-hour drive away from the Basilica, per Google Maps. Continuing on, buses from Fatima run hourly to Coimbra, a good city to visit, and from there you can get train service to Porto.
Currently, the only same-day train connection from Porto to Santiago de Compostela takes 5 hours with one connection and departs at 8:15 a.m. You need not return to Porto but if you do, the southbound trip on the same route departs Santiago at 16:25. Check schedules after the new year for your actual travel dates. The visit was very worthwhile on my trip, then I continued along the north coast of Spain.