https://docs.codehaus.moe/#/reference/npc
If you look at the NPC.spawn function, you can see that it causes an NPC to spawn and returns the NPC in question.
local myNPC = NPC.spawn(id, x, y, section)
myNPC.speedX = 4
You can look at basegame code for (for example) the SMW bowser statue for reference.