The first thing you want to do to battle algae is to remove excessive light. The worst is when sunlight reaches the tank. Algae can grow in very little light, so given sunlight (or even a tank light that's on for more than 12 hours), algae will be able to grow even faster. It's different for each tank, some of mine I can keep lit for almost 12 hours, others for only about 8.
Once you have your light regulated, you're going to want to take some extra steps to reduce algae growth. This all comes down to removing the nutrients that the algae uses to grow.
Scrape any algae you can off the glass. By far the best option is to get in there with an algae brush and get rid of it by hand. The more algae you scrape away, the less is able to grow later on. Make sure to do a small water change after this to remove the algae you just scraped free.
Check the water you use for phosphates; they act as a fertilizer for algae. If you can, get some RO water from a nearby pet store, or jugs of distilled water from a store/vending machine. You can put phosphate remover media in your tank filter and/or if you are able to, you can even put an RO filter in your sink.
Clean the gravel. Any waste from your fish, including leftover food, is going to be sitting in the gravel. That waste is food for algae, so remove it and algae can't eat. Gravel vacuums are a huge help with this.
On that note, make sure not to overfeed your fish so that there isn't any leftover food. You should only feed your fish what they will eat in a 5 minute timespan.
I've used API Algaefix on an algae bloom before and it worked. Although, I found that I would keep having to use it which I didn't like. It might work differently on black algae, but I wouldn't rely on it.
I've had the best luck with goldfish (the 15 cent feeder goldfish you can get at the store) eating all types of algae including string algae and quickly. Once they reached 3-4 inches in length 2-3 of them seem to clear a 40 gallon aquarium overnight. The only caveat is you'll need a place for your new pet goldfish. Once they grow large enough they'll start eating your plants.
There are some things you can do to proactively rid your tank of algae. If you think you have the algae taken care of for the moment, but it might come back, these are some things to think about.
Keep using phosphate removers/RO water as I mentioned above.
Add more plants to the tank. The more plants you have in the tank, the more competition there is for the resources. Even small plants can help.
I've used a UV filter to get rid of algae blooms that left my tank cloudy. While it won't get rid of algae that's attached it will kill any that's floating freely in the tank. So far the only algae it hasn't been able to get rid of is string algae.
Hydrogen Peroxide will kill algae. And will diffuse into water and oxygen after 24 hours. As part of getting rid of hair algae in my tank I quarantined my plants and dosed them with a few tablespoons for two days. If you're doing it in a tank with fish in it. It's a ratio of 1 part hydrogen peroxide to 150 parts water. (reference)
You can add algae eaters to the tank. But keep in mind that they'll only eat so much per day. So it's a matter of having a higher ratio of algae eaters to algae that they can eat.
Probably the one of the most common algae eaters are snails, nerite snails seem to be the most popular.
Shrimp are possible depending on the fish you have.
Plecostomus are a good option, but go for a bristlenose if you don't have a tank larger than 40 gallons.
My farlowella catfish seem to eat everything but string algae.
Other types of catfish won't help with algae, but should help take care of leftover food in the gravel that the algae uses for food.
If you have a larger tank, Siamese Algae Eaters and Flying Foxes are good algae eaters. They get around 6 inches in length which is why they need some space.
Source: pets.stackexchange.com