Does the spirit enter the body at the time of conception; at the time of quickening, when the mother first feels signs of life within her; or at the time of physical birth? Can it possibly come and go before the time of birth? We do not know. Such has not been made known to us in the latter days.
We do know, however, that the words of God are often spoken through his servants by divine investiture of authority (see Commentary 2:227-29). To Adam the Holy Ghost spoke for and in behalf of the Only Begotten Son (see Moses 5:9).
Such may have been the case here: The Spirit may have been commissioned by the Father to speak to Nephi in the first person for Christ, as though Jesus himself were speaking. Another possibility is that an angel, acting by that same investiture of authority, spoke to Nephi the words of Christ (see Mortal Messiah 1:349, note 1; compare Revelation 22:6-9). In any event, whether the Lord’s words are spoken by himself or by his anointed servants, “it is the same” (D&C 1:38).