NOTE: Currently I'm studying theory under a teacher so what I'm about to explain may not be totally accurate but it is a rough and layman's idea of how to work around it and explaining it is a way of how I improve in applying theory to my own playing. For those who's theory's far more better than mine, feel free to quote and add a comment if I'm wrong at some point. Thanks.
You should not only look at what is the first chord, but the whole chord progression in general. If its an E power chord, the scale doesn't have to be neccesarily a minor scale. I could play a major scale if the following power chord after E5 is a C#5. You need to know your chord progressions before you solo, that is key.
Knowing the notes of a chord can also help you figure out what kind of scale you are going to use. Think of it as tallying the notes of a chord with that of the scale. So if you are going to be using something which doesn't, it's going to sound awful like a bad taste in your mouth, or ears that is.
The E minor chord's formula consists of the 1st root note, the flat or minor 3rd (b3) and the perfect 5th in music theory. The notes will be E, G and B. You will notice these notes when you finger them on your guitar, E, B ,E, G, B E. This is somewhat how you can use scales to solo to these chords because the common pentatonic scale works in a series of tones and semitones. It's a method of mine of how I sorta tend to know the scales to solo but if it seems to be kinda irrelevant, do feel free to drop it.
Even if its an E power chord in the progression of Em, the notes that are within are just 2 or 3 notes which are the Root (E), the Fifth (B), and of course the Octave (E) again. The fifth is what is giving you the colour to that cool sounding chord, making itself known as a power chord cuz of that fifth note.
Fine, so I've been yammering on and on about chords, so what about solos? Remember how those notes of a chord sorta reoccur when you finger them. It's the same with scales. The formula for the typical pentatonic scale would be the 1st Root, Minor 3rd, Perfect 4th, Perfect 5th and Minor 7th, E G A B D.
So let's say if you happen to have a backing track in an E minor power chord progression but the problem is it starts with a G5 power chord and and even if you know it you are not allowed to use the E minor pentatonic when it plays.
If the formula for the Pentatonic Minor is E G A B D, what scale would be in the formula of G A B D E??
If you have answered this correctly, you will know what scale to use for which chord.
Cheers