Borrowed from Latin lapis (“stone”), whence also English lapidary and lapis lazuli). Alternatively through Italian lapis; compare Portuguese lápis. Doublet of lápida.
Practice speaking and memorizing "lápiz" and many other words and sentences in Spanish.