Term used amongst African Americans to denote companionship, sort of like mate is used by Brits or cunt by Australians.
The spelling/pronunciation of nigga is intended to be different from the word nigger, which is generally considered to be supremely racist. Presumably the difference arises as a result of the non-rhoticity of African American Vernacular English (AAVE). This is somewhat ironic when one considers that the (white) southern dialect was nearly universally non-rhotic in the time when slavery was still legal, and that non-rhoticity is still present in the speech of many upper class, "old money" southerners, especially amongst the older generations (i.e. descendants of plantation owners).
African Americans like to say nigga because it's different from nigger (which is racist). People whose grandparents owned 100 slaves also might use nigga, but they intend it to be racist. The irony is just too much if you ask me.