I wish to control the speed of a DC motor with a PWM provided by my Arduino Mega 2560, so is this MOSFET IRF540 ok for it? I saw its datasheet (the previous link) and it says Vgs or Vth equals +-20 V in page 1 in Absolute Maximum Ratings table, but in page 2 it says in Specifications table says 2 V min and 4 V max, so what does it mean?
Here's a brief explanation.
Absolute Maximum Ratings
When a component lists the absolute maximum rating, these are the conditions that WILL damage the part. As with all engineering, there are tradeoffs. Something about the component's design will fail at these levels (or higher). In the case of the IRF540, here's the Absolute Maximum Ratings:
As Beto pointed out, the maximum VGS listed here is ±20 V. This spec means applying more than 20 volts will destroy (or begin to destroy) the MOSFET.
You should not operate a component at the absolute maximum ratings!
The correct VGS
Beto is right, the Specification Table does show the expected operational voltage for the MOSFET. So in this case, it looks like the IRF540 is logic-level capability with a threshold between 2 and 4 volts.