Yes, build your terrain as usual and incorporate your tunnel with a short section of straight track in front of it. Place the portal and align its tracks with that of the tunnel track with its leading edge about half way along the straight track, and 99% in the tunnel. Disconnect the track from the tunnel and connect it to the portal. Lower each end of the tunnel by a small amount (about 0.2 works for me) to hide the tunnel track below the portal track.
The beginning of the tunnel needs to be straight or you will see the train disappearing through the tunnel walls. Don't let the portal hang over the baseboard or the portal may just act like track leaving rolling stock behind. You can also make a portal invisible by connecting it with invisible track. Peter