What is the use and meaning of the underlined portion of the sentence below?

The wooden splinter felt as sharp as a needle when it pierced my skin.

The phrase "as sharp as a needle" is used as a simile to convey the sharpness of the wooden splinter when it pierced the skin. It compares the sharpness of the splinter to that of a needle in order to emphasize how painful the experience was.