Bhagavad Gita 8.5
अन्तकाले च मामेव स्मरन्मुक्त्वा कलेवरम् ।
यः प्रयाति स मद्भावं याति नास्त्यत्र संशयः ॥ ५ ॥
And he who, casting off the body, goeth forth thinking upon Me only at the time of the end, he entereth into My being: there is no doubt of that.
Sanskrit text and English translation: Annie Besant, The Bhagavad-Gita, 4th edition (1922) — public domain, via Wikisource. Chapter summaries: SamayaVeda.