I realize that spanking children during childhood establishes a spanking fetish in them. I have this problem. On the Internet, I know many girls and boys who masturbate after being spanked by their parents. They also masturbate when they see their parents spank their brothers. I know a teacher who satisfies herself by spanking the pupils on their bottom in school because she has a spanking fetish. I do not know how to stop this fetish. Any pain inflicted on my bottom, even an intramuscular injection causes an erection. I also have erection when I see a girl or boy spanked on his bottom. I am seeking freedom from this. Could you please help me to get freedom from this?
You have a few misconceptions. Spanking does not cause fetishes. Many children have been spanked and the vast majority do not grow up with a spanking fetish. Just because you know a few doesn't mean that most of the world is like you.
Second, you are confusing a physiological response with a need for sex. Just because your penis becomes erect, it doesn't follow that any action needs to be taken in regards to it. Males have erections frequently. During early adolescence erections came randomly and frequently as the body adjusted to its new ability. Yes, anything that causes tension can trigger an erection; that is simply because an erection is caused by a muscle at the base of the penis clamping down on a vein which then causes blood to back up in the penis and inflate it.
Bad habits are broken by ending them and replacing them with something better. In reality the stories and videos on the Internet that sexualize spanking are a form of pornography. They appeal to people's baser instincts to dominate others (the "pride of life" - I John 2:16-17). Thereby, they get a person's heart beating faster. The thought of pain makes a person tense in sympathy. Combined they make erections more likely. What you need to realize is that you are being manipulated and not for your benefit. Therefore, like any other pornography, you need to remove it from you life. Put blocks on the computers and phones that you use to access the Internet.
Next, think about when you have urges to go and look at such things. Some common reasons are that a person is bored, or that they have a habit of doing this at certain times of the day or week. Recognizing the cause, find better things to do with your time that doesn't include the bad habit.
"For this is the will of God, your sanctification: that you should abstain from sexual immorality; that each of you should know how to possess his own vessel in sanctification and honor, not in passion of lust, like the Gentiles who do not know God" (I Thessalonians 4:3-5).