The words Father, Son and Holy Ghost are titles, not names. It was a direction, a commandment to GO do it. Many people picture Peter at heavens gate because of this. Peter shared these same keys with us. . . Peter knew, and the other Apostles standing there with him knew.
Salvation IS a gift.
Works of righteousness are feeding the hungry, sheltering the homeless, etc., etc. You cannot earn salvation by doing good works. Even so faith, if it hath not works, is dead, being alone. For as the body without the spirit is dead, so faith without works is dead also. If you do not OBEY His commandments you are none of His.