Here's an example.
In a recent game I DMed, a major NPC that both fought and later allied with the PCs was a drow who was a savant with teleportation magic. The NPC was 15th level equivalent (had 15 Hit Dice) and had these abilities:
Magic missile, cast at 3rd level, at-will
Armor of agathys, cast at 4th level, swapped to force damage instead of cold, 1/SR
Arcane gate at will
Create permanent teleport circle with 1 full day of work and 1000gp in rare, specialized reagents
Definitely one of the best NPCs I've played, and the players both hated and loved him. But, I feel like there's several people on this thread who would tell me I'm playing incorrectly by running a humanoid NPC that has abilities that are completely out of the bounds of a "normal" PC build.