Yes, you can.
You need to establish mystical link in order to cast the spell (SR5, p281):
You need to be able to establish a link with your target - depending on the spell, you'll need to be able to see or touch the taret in order to establish the mystical link.
While the relevant text in SR5 is lacking, it seems that the mechanic behind spell targeting has not changed since SR4 - you need LoS, touch or whatever to establish the link and not to sustain it (SR4 FAQ, spellcasting)
Do you need to maintain line of sight (or touch, with Touch range spells) to sustain a spell? What about Permanent spells?
A spell requires a magical link (touch, sight, material link, symbolic link, etc.) to cast. There is, however, no requirement for the magician to maintain touch or line-of-sight while maintaining the spell, as the link between caster and spell is already in effect. By the same principle, you do not need to maintain touch or line of sight when casting a Permanent spell; the spell must simply be maintained until the spell's effects become permanent.
Beware of Mana Barriers, though!