The practice and the expression is sometimes to touch wood or to knock on wood:
This phrase is used by people who rap their knuckles on a piece of wood hoping to stave off bad luck. In the UK, the phrase 'touch wood' is used - often jokingly by tapping one's head. The phrases are sometimes spoken when a person is already experiencing some good fortune and hope that it will continue - for example "I've been winning on every race - touch wood".
Some think that it has Christian origins, some that the origin is pre-Christian:
The derivation may be the association that wood and trees have with good spirits in mythology, or with the Christian cross. It used to be considered good luck to tap trees to let the wood spirits within know you were there. Traditions of this sort still persist in Ireland. [...]
It isn't clear when 'touch wood' began to be used as a token of good fortune but it must have been by 1850, when the academic correspondence magazine Notes and Queries published this:
There probably is some old English expression for averting evil, but it does not come to mind; "I touch wood," "Bar omen," "Bar ill-luck," seem clumsy.
It is interesting, that there are other languages that use a similar expression. This forum is not as good a reference as a dictionary, but the discussion about 'knock on/touch wood' in other languages might be interesting to you.