Fix a piece of masking tape over the holes on the shelf.
Draw a line with a straight edge through the centre of the holes.
Draw a line vertically through each hole.
Mark the top of the shelf with an arrow.
Measure the distance between the two holes and mark the centre.
Use the centre mark on the tape to postion the shelf. Fix one side and use a spirit level to level the line on the tape.
Place an envelope below to catch dust and drill holes.
Carefully remove tape.
Fix shelf to wall.