What kind of snake is this? Seen in Peru along the Inca Trail
EDIT: Apparently M. medemi only exists in Colombia, not in Peru. Thus, as I'm not sure about the below ID. Instead of deleting the answer (users with &lt;10k cannot see it), I just turned this into a community wiki, so I don't receive any RP.

By the shape of the head and the structure of the rings, it seems to me that this is a Micrurus.
Of course, the lack of yellow/red rings excludes the most common coral species, like Micrurus peruvianus. So, I'd guess this is a Micrurus medemi.
Here is another picture of it, for comparison:

Source: http://www.planetscott.com/speciesdetail/10840/coral-snake-micrurus-medemi
Some M. medemi specimens have white rings (like in your photo) while some have red rings.
They are venomous, but they are not dangerous: all Micrurus species I'm aware of are not aggressive, and bites are not common. As Wikipedia correctly says:

When confronted by humans, coral snakes will almost always attempt to flee, and bite only as a last resort.

The problem with this ID is that there are reports of M. medemi in Colombia and Ecuador, but not in Peru. I'll keep researching this and update this answer when I find a record (or delete it if I don't).