Though the meaning is all but forgotten, and they are often regarded as nothing more than a Harvestide decoration, the tradition of carving and placing jack-o'-lanterns is actually an ancient and effective folk-magic ritual to protect one's home from the spirits that roam the night at harvest time.
You carve a jack-o'-lantern from a hollowed out pumpkin of large turnip. The jack-o'-lantern can be carved by hand, or made by magic. A creature without spell slots may learn to perform the hand-carved version of this ritual. A creature with spell slots may choose to create a jack-o'-lantern by carving it by hand or by magic.
Hand-Carved: Knife in hand, you set to carving a jack-o'-lantern the traditional way. Carving a jack-o'-lantern by hand takes a minimum of 5 minutes, but does not expend a spell slot. When you make a jack-o'-lantern by hand, you make an ability check to craft it. You add a +1 bonus to this check for every additional 5 minutes you spend carving the jack-o'-lantern past the first 5 minutes, to a maximum of +5. The result of this ability check sets the DC for the jack-o'-lantern's magical effect. When performing this ritual by hand, it cannot be cast at higher levels.
Magic-Made: You point your knife and cause the vegetable's rind to split and crumble to form a face precisely as you pictured it. Creating a jack-o'-lantern by magic has a casting time of 1 action rather than 5 minutes, and expends a spell slot as normal. A jack-o'-lantern created by magic uses your spellcasting DC for its magical effect. A jack-o'-lantern made by magic can be cast at a higher level.
Once created, a jack-o'-lantern will last for 7 days without being lit, after which its magic dissipate and it begins to rot.
A jack-o'-lantern's magic only functions between sunset and sunrise, and activates when it's candle or coal is lit, which requires an action. A jack-o'-lantern's light will burn for up to 6 hours before going out. A jack-o'-lantern's magic goes into effect the moment it is lit and ends immediately when it goes out. Once a jack-o'-lantern is extinguished, it's magic is expended and cannot be restored, even if it is relit.
When lit, a jack-o'-lantern sheds dim light in a 30-foot radius which persists even in magical darkness and wards off celestials, elementals, fey, fiends, and undead. When a creature of one of these types attempts to enter a space lit by the jack-o'-lantern's light, it must make a Charisma saving throw against the DC determined at jack-o'-lantern's creation, plus 1 for each additional jack-o'-lantern within 10 feet of that jack-o'-lantern. If a creature would be subjected to multiple saving throws by multiple jack-o'-lanterns, it makes only 1 saving throw against the jack-o'-lantern with the highest DC. On a failed save, that creature is frightened of the jack-o'-lantern for 1 minute, ignoring immunity to the frightened condition, and is pushed back to the nearest unoccupied space not within the jack-o'-lantern's light. If a creature fails its save by 5 or more, it is turned for 1 minute or until it takes any damage.
A turned creature must spend its turns trying to move as far away from the jack-o'-lantern as it can, and it can’t willingly move to a space within 30 feet of it. It also can’t take reactions. For its action, it can use only the Dash action or try to escape from an effect that prevents it from moving. If there’s nowhere to move, the creature can use the Dodge action. Additionally, a creature that has been turned by this effect can’t enter the area again until the jack-o'-lantern goes out.
Even if a creature succeeds on its saving throw, the jack-o'-lantern's magic hinders it; while the creature is within 30 feet of the jack-o'-lantern it is affected a it would be by the bane spell. The spell ends for the creature once it moves out of range.
A jack-o'-lantern's effects extend into the Ethereal Plane, and creatures on the Ethereal Plane have disadvantage on their saving throw against its effect. Destroying a jack-o'-lantern extinguishes it instantly. A jack-o'-lantern has an AC of 10 and 1 hit point, and cannot be targeted by any attack roll made by a creature that has failed its save against its effect. A jack-o'-lantern is destroyed instantly if it falls from a height greater than 2 feet.
As an action, a jack-o'-lantern can be thrown up to 20 feet, smashing it on impact. Make a ranged attack against a target creature, treating the jack-o'-lantern as an improvised weapon with the thrown property. On a hit, the target takes 1d6 bludgeoning damage plus 1d4 fire damage. If the target is a celestial, elemental, fey, fiend, or undead, it takes an additional 2d6 radiant damage.
At Higher Levels. When you cast this spell using a spell slot of 2nd level or higher, the spell creates one additional jack-o'-lantern for each slot level above 1st.
* - (a pumpkin or large turnip, a knife, and a candle or coal)
Flavorful spell, but the description is somewhat convoluted. As written-- with all these various effects-- I think the spell level should higher. Compare it to the simple 1st level cause fear or 3rd level fear. In contrast, this one offers fear effects, warding effects, extends into the Ethereal Plane, can be used as a "bomb", and last for hours!
Perhaps make the magical Jack-o'-lantern an uncommon or rare magic item instead.
In a way, it already is. When cast, the spell creates a magic item, which I have also created here. I primarily based my decision on its level on the difficulty of creating an actual jack-o'-lantern (which isn't much and anyone can do) and the lore attributed to why they are carved.
I will concede that the effects are powerful, but there are mitigating factors which I feel justify its level. For one, the fear effect is limited to specific creature types, most of which are not typically encountered at the lower levels the spell would be available to selection, meaning its usefulness is limited in campaigns that don't use them as often as other creature types. Another is that the magic item created by the spell is fragile, which again is based partially on reality; it doesn't take much to smash a jack-o'-lantern. With only 1 hit point, they are only a minor set back to an affected creature with any intelligence.
At higher levels, the bomb effect of a lit jack-o'-lantern also becomes less useful. 12 (3d6 + 1d4) damage as an action isn't much by way damage when you consider the higher damage output of more action-economy-minded aspects of the game, such as a fighter's extra attack. And that damage is only against the specified creature types, else it deals 5 (1d6 + 1d4) damage.