I recognized Mary the moment I saw her.

Literal

I [topic-は] saw-[instant-とたんに] Mary [quotative-だと] understood.

The pattern ~たとたんに ('the instant X happened') marks immediate recognition. The loanword rendering of 'Mary' as メアリー in katakana is standard for foreign names in Japanese.