If it truly only hurts slightly, and you're otherwise able to perform the required stretch, then try continuing that way. If the discomfort lessens, that's a good sign; if it grows worse, it's a bad sign: at the very least you need a break from practicing that music, or that passage, and possibly to change what you're doing.
If you're not able to perform the music properly, then your stretch is insufficient. It will not increase, just from trying. It could be that just throwing yourself at the stretch will increase your span by, say, millimeter over time. If you need seven millimeters, that's not nearly enough. (If you're still a child or young adult, not yet fully grown, you have a chance that way.)
It's not advisable to persist in something that hurts, in a situation where the goal is not attainable in that manner.
In the pursuit of a musical instrument, there are some pains along the way, due to the body adjusting to the stresses of acquiring new skills. There are some good pains and there are some bad ones; you have to learn to "play it by ear".
Any sudden, sharp pain is a sign to stop. So is pain that is trending for the worse day over day.
Regarding stretching, do not apply external forces to try to make your reach bigger. If the discomfort you're experiencing is just from your hand's own effort at stretching, that is a lot less dangerous than if you start forcing your fingers into stretched positions using your other hand, or some sort of tool.