Not only are both "an opportunity" and "the opportunity" acceptable, both are commonly in use in North America. Subjectively, I feel as if there is no bias towards one phrase or the other, so I pulled up a Google Ngram for the two phrases, and it suggests that "an opportunity" was more common prior to 1980, while "the opportunity" is more common today. Not much more common, to be honest, but slightly.
Strictly speaking, there is a subtle difference between the phrases. "This gives me the opportunity" suggests that there is an opportunity that we are both aware of, while "this gives me an opportunity" suggests that there are more opportunities than this one. In practice however, the phrases are used interchangeably and without any real or true distinction.