Rapper Bun B opened fire on an armed masked intruder inside his Texas home after he caught the man trying to steal his wife's Audi.

The intruder, identified as Demonte Alis Jackson, knocked on the front door of Bun B's Houston home at about 5.45pm on Tuesday night.

He pointed a gun at the rapper's wife, Angela Walls, when she opened the door, TMZ reports.

Bun B's wife told the masked gunman to take her luxury car that was parked in the garage when he demanded valuables.

Rapper Bun B shot at the armed masked intruder when he knocked on the door of his Houston, Texas home on Tuesday night and started demanding valuables

The intruder Demonte Alis Jackson faced court on Wednesday with his arm in a sling after being charged with aggravated robbery with a weapon and burglary

The rapper, armed with his own gun, shot at the intruder as he was getting into the Audi.

After a brief shootout, the intruder ran from the rapper's home and left his gun behind.

The masked intruder went to a Houston area hospital several hours later suffering from a gunshot wound to his shoulder.

He was arrested for aggravated robbery with a weapon and burglary after being treated.

Bun B, whose real name is Bernard Freeman, is a Grammy-nominated rapper.

Neither him or his wife were injured in the ordeal.

The intruder faced court on Wednesday with his arm in a sling.

Bun B, whose real name is Bernard Freeman, was home with his wife Angela Walls when the masked intruder knocked on the door demanding valuables