The first question to ask is what it is to "know" a word. According to J.M. Wallace (Teaching Vocabulary, 1982) it involves the following things (quoted in the video Learning Vocabulary in Context Part 1):
A. Recognize it in its spoken or written form;
B. Recall it at will;
C. Relate it to an appropriate object or concept;
D. Use it in the appropriate grammatical form;
E. In speech, pronounce it in a recognizable way;
F. In writing, spell it correctly;
G. Use it with words it correctly goes with, i.e. in the correct collocation;
H. Use it at the appropriate level of formality;
I. Be aware of its connotations and associations.
This list contains a number of aspects that you can learn by using word lists, but it also contains aspects that you won't get from word lists, especially collocations. This is one reason why some teachers and experience language learners advise learning words in context.
There has been research on the effectiveness of learning words in context or outside their context (i.e. contextualised versus decontextualised vocabulary learning). Brian Nielsen wrote A Review of Research into Vocabulary Learning and Acquisition, concluding that
Greater amounts of decontextualized vocabulary instruction should be given to beginner-level learners, gradually increasing toward more context-based vocabulary learning as their language ability develops.
In another study, Seyyed Mohammad Reza Amirian and Sakine Momeni concluded that
The findings of the study showed better results of vocabulary knowledge gain in out of context teaching than the contextualized one which means that the results can be a support of definition-based learning. However, the results should be taken as suggestive rather than definitive, since there are many variables which affect an effective vocabulary learning and teaching principle. Thus, this does not mean that contextualized teaching should be avoided. It seems that the most effective way of teaching in Iranian EFL classes is to start the teaching of the new lesson first by defining the words. This will be a helpful approach to reduce the load of so many new words in the reading text. The next essential step is reading the texts which are related to the vocabularies taught.
They add that
It is noteworthy that context-based and definition-based are neither the only vocabulary learning techniques nor the best techniques that are available for learning. Introducing and having learners practice using a variety of alternative vocabulary learning strategies can be considered an effective way of enabling learners to achieve more effective independent vocabulary learning in the future. (...) Extensive reading is also believed to be an excellent activity that improves vocabulary knowledge and increases learner‟s autonomy. (...)
So the conclusion is that both can be used, but neither method should be used exclusively.