The castle was briefly visible from the train window.

Literal

Train [of-の] window [from-から] that castle [subject-が] for-a-moment was-visible.

ちらりと is a variant of ちらっと — both mimetic adverbs for 'briefly, fleetingly, out of the corner of the eye.' Both forms are accepted, with ちらりと being slightly more literary/written. 城 ('castle') is the object of fleeting view, marked with が as the subject of the spontaneous-perception 見える.