Here, "nicely" is serving as an adverb to give an information about the verb of the sentence ("talk"). Even though it comes from the adjective <em>nice</em>, which would modify a noun or a pronoun and not a verb, the addition of the suffix <em>-ly</em> makes it an adverb. That is why it works in this sentence.
"the occasional scratch of her pen exerted just enough pressure to keep away the frightening shadows, the sad spirits from long ago, locked into events that couldn't change."